[BUG] MCP FastMCP Pydantic model parameters still serialized as JSON strings, despite previous bug ticket as being closed as fixed

Resolved 💬 5 comments Opened Sep 18, 2025 by skray Closed Sep 19, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When I connect Claude Code to my FastMCP MCP server, all tool calls fail with errors like

Error: Input validation error: '{"name": "test", "age": 25}' is not of type 'object'

There is a full reproduction and explanation if this issue in https://github.com/anthropics/claude-code/issues/3084 that was marked as fixed and closed, but the issue still persists as of Claude Code 1.0.117

What Should Happen?

Claude Code should call tools successfully

Error Messages/Logs

➜  claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /Users/sray/dev                            │
╰───────────────────────────────────────────────────╯

> /mcp
  ⎿  (no content)

> call the test_pydantic_model tool

⏺ fastmcp - test_pydantic_model (MCP)(data: "{\"name\": \"test\", \"age\": 25}")
  ⎿  Error: Input validation error: '{"name": "test", "age": 25}' is not of type 'object'

⏺ fastmcp - test_pydantic_model (MCP)(data: "{\"name\": \"test\", \"age\": 25}")
  ⎿  Error: Input validation error: '{"name": "test", "age": 25}' is not of type 'object'

⏺ The tool requires a proper object parameter. Let me check the schema and call it correctly:

⏺ fastmcp - test_pydantic_model (MCP)(data: "{\"name\": \"Alice\", \"age\": 30}")
  ⎿  Error: Input validation error: '{"name": "Alice", "age": 30}' is not of type 'object'

⏺ Looking at the schema more carefully, the data parameter should be a proper object, not a JSON string:

⏺ fastmcp - test_pydantic_model (MCP)(data: "{\n  \"name\": \"Alice\",\n  \"age\": 30\n}")
  ⎿  Error: Input validation error: '{\n  "name": "Alice",\n  "age": 30\n}' is not of type 'object'

⏺ The test_pydantic_model tool has been called but appears to have a validation issue with how the data parameter is being passed. The schema expects an
  object type but the tool seems to be receiving it as a string.

Steps to Reproduce

Copied from https://github.com/anthropics/claude-code/issues/3084
  1. Create a FastMCP server with a Pydantic model parameter:
from fastmcp import FastMCP, Context
from pydantic import BaseModel

mcp = FastMCP("test-server", version="1.0.0")

class TestModel(BaseModel):
    name: str
    age: int

@mcp.tool
def test_pydantic_model(data: TestModel) -> str:
    """Test tool with Pydantic model parameter."""
    return f"Hello {data.name}, age {data.age}"
  1. Configure the server in Claude Code MCP settings
  2. Attempt to call the tool:
mcp__test-server__test_pydantic_model({
  "data": {"name": "John", "age": 30}
})
  1. Observe the validation error

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.117

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗