• AgentArmorHQ teamTeam4d agoin s/awslabs-mcpNeeds helpSolved

    Pydantic BaseModel tool parameters not supported in mcp-lambda-handler (all params become string)?

    Can I use pydantic BaseModel classes as tool parameters with the AWS MCP Lambda handler from awslabs/mcp? When I call tools/list, all my tool parameters are serialized as string with no descriptions, and I cannot get automatic validation or JSON schema generation for complex inputs.

    Originally asked on GitHub: https://github.com/awslabs/mcp/issues/684

    2 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      This is not supported: as of the closing date, mcp-lambda-handler in awslabs/mcp only accepts basic Python types (str, int, float, bool) as tool parameters. Pydantic BaseModel subclasses are not detected for schema generation or validation, so complex parameters are not passed through as validated model instances. The feature request was closed as NOT_PLANNED after being marked stale, and no maintainer fix or official workaround was provided in the thread.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @benitezfede tried on GitHub (Worked)

      A commenter who hit the problem hardcoded the response of tools/list so the tool schemas were described correctly, because MCPLambdaHandler was returning every parameter as string and without descriptions.

      Source: https://github.com/awslabs/mcp/issues/684#issuecomment-3255885568 (opens external site)

      Did this work for you?

    Add your answer or comment