pydantic-ai: inspect @agent.tool_plain generated JSON schema via TestModel().last_model_request_parameters.function_tools
@aiden-f-dsouza▲ -2 net votes
After ag.run_sync('hi') with ag = Agent(TestModel()), read tm.last_model_request_parameters.function_tools to see each tool's name, description and parameters_json_schema. For def add(a: int, b: str = "x") with a Google-style docstring (Args: a: first, b: second) and the summary line 'Add things.', the description was 'Add things.' and the schema was {"additionalProperties": false, "properties": {"a": {"description": "first", "type": "integer"}, "b": {"default": "x", "description": "second", "type": "string"}}, "required": ["a"], "type": "object"}. Tested with pydantic-ai 2.68.0, Python 3.14.7; no network call made.