Skip to content

TypedDict as input_schema in 'tool' does not show visible parameters to bot #169

@Riehantunut

Description

@Riehantunut

The docstring of the tool shows that a TypedDict can be inserted as input_schema for declared functions inputted into an MCP server, this is from claude_code_sdk/init.py:

def tool(
    name: str, description: str, input_schema: type | dict[str, Any]
) -> Callable[[Callable[[Any], Awaitable[dict[str, Any]]]], SdkMcpTool[Any]]:
    """Decorator for defining MCP tools with type safety.

    Creates a tool that can be used with SDK MCP servers. The tool runs
    in-process within your Python application, providing better performance
    than external MCP servers.

    Args:
        name: Unique identifier for the tool. This is what Claude will use
            to reference the tool in function calls.
        description: Human-readable description of what the tool does.
            This helps Claude understand when to use the tool.
        input_schema: Schema defining the tool's input parameters.
            Can be either:
            - A dictionary mapping parameter names to types (e.g., {"text": str})
            - A **TypedDict** class for more complex schemas
            - A JSON Schema dictionary for full validation

But then inserting a TypedDict, Claude Code cannot see any params.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions