OpenHands / OpenHands/software-agent-sdk

[Bug]: MCP tool calls emit FastMCPDeprecationWarning for inputSchema/isError/mimeType on fastmcp>=4.0

Open
#4,925 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
539
Avg merge
1d 19h
Merged PRs (30d)
137

Description

Is there an existing issue for the same bug?
  • I have searched existing issues and this is not a duplicate.
Bug Description

Every MCP tool call logs FastMCPDeprecationWarning for Tool.inputSchema, CallToolResult.isError, and ImageContent.mimeType, because five call sites in the SDK still read the pre-4.0 field names (mcp/tool.py x4, mcp/definition.py x2, agent/agent.py, agent_server/mcp_router.py). openhands-sdk pins fastmcp>=3.2.0 with no upper bound, so any fresh, non-locked install can resolve fastmcp>=4.0, which renamed these fields to input_schema/is_error/mime_type and kept the old names only as deprecated compat properties.

Expected Behavior

MCP tool calls should not emit deprecation warnings on a supported, freshly-resolved fastmcp version.

Actual Behavior

Reproduced with fastmcp==4.0.1 / mcp==2.1.1 installed over the repo's own venv:

python -c "
import mcp.types as t
tool = t.Tool(name='x', inputSchema={'type': 'object'})
_ = tool.inputSchema  # triggers the warning below
"
FastMCPDeprecationWarning: Accessing `Tool.inputSchema` is deprecated; MCP SDK v2 renamed this field to `input_schema`. Update your code to read `.input_schema` instead.

The same happens for CallToolResult.isError and ImageContent.mimeType at runtime whenever an MCP tool call returns through MCPToolObservation.from_call_tool_result.

Steps to Reproduce
  1. uv pip install "fastmcp==4.0.1" inside the repo's own venv (its own lockfile pins fastmcp==3.2.0, where the old names are the only ones that exist, so this simulates a consumer whose independent dependency resolution lands on a newer, still-compatible fastmcp).
  2. python -m pytest tests/sdk/mcp/ -W error::FastMCPDeprecationWarning -q (or just call any MCP tool with warnings elevated to errors).
  3. Warnings/errors on Tool.inputSchema, CallToolResult.isError, ImageContent.mimeType.
Acceptance Criteria
  • No FastMCPDeprecationWarning on a supported fastmcp version >= the pinned floor
  • Existing test suite still passes unchanged on the currently pinned fastmcp==3.2.0 (no dependency floor bump required)
Installation Method

pip install -e . (repo dev install via make build)

SDK Version

main branch, commit 7a01890

Python Version

3.13.13

Additional Context

Fix proposed in #4924: a small compat_attr(obj, new_name, old_name) helper that reads whichever name the installed mcp.types object actually has, instead of bumping the fastmcp floor (which was tried first but surfaced an unrelated MCP session-persistence regression on fastmcp==4.0.1 — worth its own issue/investigation, out of scope here).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/sdk/mcp/ and reproduce with warnings elevated to errors using fastmcp==4.0.1. Inspect the listed call sites in mcp/tool.py, mcp/definition.py, agent/agent.py, and agent_server/mcp_router.py, along with the proposed compatibility approach in issue #4924. Done means MCP calls emit no deprecation warnings on supported versions while the existing suite passes with fastmcp==3.2.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.