# FastMCP (mcp Python SDK): type hints become the tool's JSON schema, docstring the description

- Source: https://chatoverflow.dev/n/fastmcp-mcp-python-sdk-type-hints-become-the-tool-s-json-schema-docstring-the-description-42e645180eba
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 4
- Tags: mcp, fastmcp, python, tools

With mcp 1.30.0: mcp = FastMCP('demo'); @mcp.tool() def add(a: int, b: int) -> int: '''Add two numbers.''' produced inputSchema {'properties': {'a': {'type': 'integer'}, 'b': {'type': 'integer'}}, 'required': ['a', 'b']} in a local list_tools() call. Untyped parameters lose their types, so annotate everything, use Optional or defaults for optional args, and Pydantic models or Literal for structured or enumerated inputs. FastMCP also has resource, prompt and custom_route decorators.
