fastmcp icon indicating copy to clipboard operation
fastmcp copied to clipboard

Are path parameter descriptions being honoured?

Open jaydeepk opened this issue 8 months ago • 1 comments

Description

First of all, amazing tool, really enjoyed working with it. This is more of a question in terms of am I missing something.

I'm trying to setup an MCP server using an open api spec. I have a get endpoint with a path parameter.

paths:
  /conferences/{conf_id}/schedule-lite:
    get:
      operationId: getConferenceSchedule
      summary: Get the schedule of sessions for a specific conference
      parameters:
        - name: conf_id
          in: path
          required: true
          schema:
            type: string
          example: agile-india-2025
          description: |
                  The conference ID in kebab-case format (all lowercase with hyphens, like `agile-india-2025`).
                  If a user says "Agile India 2025", convert it to lowercase and replace spaces with hyphens.

No although the MCP inspector does show this as a resource template, somehow Claude Desktop is not seeing it. But that's a separate issue.

I passed in a custom map to set all GET endpoints as tools :

custom_maps = [
    # Force all analytics endpoints to be Tools
    RouteMap(methods=["GET"], 
             pattern=r"^.*", 
             route_type=RouteType.TOOL)
]

With this Claude Desktop recognizes this as a tool. However it does not seem to able to infer the conf_id query parmeter properly. If I ask: What is the schedule for the Agile India 2025 conference, I expect it to understand to make the tool call using conf_id : agile-india-2025 However it still passes: conf_id as Agile India 2025 even though I have described how the parameter should look like and also provided an example.

If I register the tool manually:

@mcp.tool()
async def get_schedule(conf_id) -> str:
    """Get conference schedule.

    Args:
        conf_id: Conference ID in **kebab-case format** (all lowercase with hyphens, e.g., 'agile-india-2025').
    """

Claude Desktop correctly passes conf_id as 'agile-india-2025'.

So my question is am I missing something in the spec here ? Is there anything that can be added/amended in the spec to improve how the LLM works with the registered tool ?

Example Code


Version Information

FastMCP version:                                                                    2.2.6
MCP version:                                                                        1.6.0
Python version:                                                                    3.13.1
Platform:                                               macOS-14.5-arm64-arm-64bit-Mach-O
FastMCP root path: /Users/jaydeep/znsio/confengine_mcp/.venv/lib/python3.13/site-packages

Additional Context

No response

jaydeepk avatar May 01 '25 12:05 jaydeepk

I'll look into affirming that descriptions are being passed. On the other issue - Claude Desktop has historically had no support for templates, I'm not sure of the current status.

jlowin avatar May 01 '25 13:05 jlowin

Great ..thanks for the prompt response @jlowin

jaydeepk avatar May 01 '25 14:05 jaydeepk