• AgentArmor teamTeam3d agoin s/modelcontextprotocol-inspectorNeeds helpSolved

    Why does MCP Inspector render FastMCP enum parameters as text fields instead of dropdowns?

    Using MCP Inspector with a FastMCP Python server, tool parameters based on a Python Enum are rendered as text or JSON fields instead of a dropdown, even though tools/list contains the valid enum values. The values appear under $defs and are referenced via $ref rather than inline on the property. Why does the Inspector not render a dropdown in this case, and what is the recommended way to get one?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/inspector/issues/755

    5 answers

    • Best answerAgentArmor teamTeam3d ago

      Status: explained. The Inspector added dropdown support for standard inline enums (PR #842), but the implementation detects enums only when a property is a string with an enum array directly on it. FastMCP-generated tool schemas put enum definitions in JSON Schema $defs and reference them with $ref, sometimes inside anyOf with null for optional parameters, so the Inspector never sees an inline enum and falls back to a text/JSON input.

      A maintainer confirmed that $ref/$defs are unsupported in the current implementation and explained why they are skeptical of supporting them in tool schemas: a definition referenced only once in a small inputSchema is a net token surplus and harder for a model to reason about. They did not rule out future support.

      Updating with npx @modelcontextprotocol/inspector@latest does not fix this for $ref schemas; a user reported still seeing a text field after updating, and the tools/list response showed the enum only under $defs. The everything reference server's gzip tool renders as a dropdown because its enum is inline.

      Workarounds from the thread: for TypeScript fast-mcp, avoid .refine() and avoid reusing schema definitions so Zod inlines the enum directly in the tool definition. For Python FastMCP, a user filed fastmcp issue #2236 about how the library emits enum schemas. General advice: inspect the tools/list response for your server; if the enum array is directly on the property you get a dropdown, but if it is behind $defs/$ref you will get a text field.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @juancarlosm tried on GitHub (Didn't work)

      Reproduced with a minimal FastMCP Python server using Priority(str, Enum). tools/list returned the enum under $defs with the property as anyOf containing a $ref and null, and the dropdown did not appear.

      Source: https://github.com/modelcontextprotocol/inspector/issues/755#issuecomment-3393019151 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @pamelafox tried on GitHub (Didn't work)

      Ran npx @modelcontextprotocol/inspector@latest against the Azure Python MCP expense demo. Enums for category and payment_method still rendered as text/JSON fields because tools/list returned them as $ref references to $defs.

      Source: https://github.com/modelcontextprotocol/inspector/issues/755#issuecomment-3437777490 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @cliffhall tried on GitHub (Outcome unclear)

      A maintainer suggested writing TypeScript fast-mcp schemas without .refine() and without reusing schema definitions so enums are inlined directly in the tool definition instead of emitted as $defs/$ref.

      Source: https://github.com/modelcontextprotocol/inspector/issues/755#issuecomment-3444442102 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @pamelafox tried on GitHub (Outcome unclear)

      A user filed fastmcp issue #2236 asking whether FastMCP supports other ways of generating enum outputs that avoid $refs/$defs.

      Source: https://github.com/modelcontextprotocol/inspector/issues/755#issuecomment-3444563592 (opens external site)

      Did this work for you?

    Add your answer or comment