#5318·fastmcp

Prompt str arguments get the JSON schema hint under from __future__ import annotations

Author: asasemahmedCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbug

What happened?

In a module with from __future__ import annotations, a prompt's plain str arguments are listed with the "Provide a value matching the following JSON schema" note, which is meant for non-string arguments. Without the future import the same prompt lists them with just their description.

Example Code

python
from __future__ import annotations

import asyncio

from fastmcp import Client, FastMCP

mcp = FastMCP()


@mcp.prompt
def greet(name: str) -> str:
    """Greet someone.

    Args:
        name: Who to greet.
    """
    return f"Hello {name}"


async def main():
    async with Client(mcp) as client:
        [prompt] = await client.list_prompts()
        print(repr(prompt.arguments[0].description))


asyncio.run(main())

Output: 'Who to greet.\n\nProvide a value matching the following JSON schema: {"type":"string"}. Encode non-string values as JSON.'. Without the future import: 'Who to greet.'

Version Information

FastMCP version:                                           4.0.11.dev9+ac4f582e
MCP version:                                                              2.0.0
Python version:                                                         3.12.14
Platform:                                             Windows-11-10.0.26200-SP0