Skip to content

No support of inputSchema in mcp.tool decorator #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fmtsvetkov opened this issue May 21, 2025 · 1 comment
Open

No support of inputSchema in mcp.tool decorator #772

fmtsvetkov opened this issue May 21, 2025 · 1 comment

Comments

@fmtsvetkov
Copy link

Describe the bug
It's more an inconsistence than a bug but there is no "inputSchema" field in mcp.tool decorator while it's available in Tool

To Reproduce
@mcp.tool(
name="Name",
description=(
"description"
),
inputSchema = {}
)

Expected behavior
Add of mcp tool to mcp server

Current behavior
TypeError: FastMCP.tool() got an unexpected keyword argument 'inputSchema'

@ivanbelenky
Copy link

The actual inputSchema is missing based on the fact that there are 2 types of Tool obejcts, the internal server implementation and the protocol one usually imported as MCPTool. Have you chekced both tools structures?

in fastmcp.tools.base

class Tool(BaseModel):
    """Internal tool registration info."""

    fn: Callable[..., Any] = Field(exclude=True)
    name: str = Field(description="Name of the tool")
    description: str = Field(description="Description of what the tool does")
    parameters: dict[str, Any] = Field(description="JSON schema for tool parameters")
    fn_metadata: FuncMetadata = Field(
        description="Metadata about the function including a pydantic model for tool"
        " arguments"
    )
    is_async: bool = Field(description="Whether the tool is async")
    context_kwarg: str | None = Field(
        None, description="Name of the kwarg that should receive context"
    )
    annotations: ToolAnnotations | None = Field(
        None, description="Optional annotations for the tool"
    )

in types

# types.py
class Tool(BaseModel):
    """Definition for a tool the client can call."""

    name: str
    """The name of the tool."""
    description: str | None = None
    """A human-readable description of the tool."""
    inputSchema: dict[str, Any]
    """A JSON Schema object defining the expected parameters for the tool."""
    annotations: ToolAnnotations | None = None
    """Optional additional tool information."""
    model_config = ConfigDict(extra="allow")

I know nothing about nothing but allowing for inputSchema would require extra validation with respect to the automatically introspective build of parameters that precisely holds that info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants