Skip to content

Unable to add annotations data with @FastMCP.tool() decorator #511

Open
@a-s-g93

Description

@a-s-g93

Describe the bug
The MCP documentation states that we can declare annotations in the @mcp.tool() decorator with the Python SDK, however this functionality is not present in the code.

Documentation:
https://modelcontextprotocol.io/docs/concepts/tools#python

Location in code base:
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/server/fastmcp/server.py#L262

To Reproduce
Steps to reproduce the behavior:

  • Decorate a function with <fastMCP server name>.tool(annotations={"example":"example_val"})
  • Run the MCP Server in Claude Desktop
  • This should populate the logs with the following error: TypeError: FastMCP.tool() got an unexpected keyword argument 'annotations'

Expected behavior
This should be valid and add annotation data to the tool.

Desktop (please complete the following information):

  • OS: MacOS
  • Version 15.3.2
  • Python 3.12.7
  • mcp[cli] 1.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy