diff --git a/pydantic_ai_slim/pydantic_ai/mcp.py b/pydantic_ai_slim/pydantic_ai/mcp.py index 93e6e018d..44b857016 100644 --- a/pydantic_ai_slim/pydantic_ai/mcp.py +++ b/pydantic_ai_slim/pydantic_ai/mcp.py @@ -34,6 +34,7 @@ class MCPServer(ABC): """ is_running: bool = False + strict: bool | None = None _client: ClientSession _read_stream: MemoryObjectReceiveStream[JSONRPCMessage | Exception] @@ -64,6 +65,7 @@ async def list_tools(self) -> list[ToolDefinition]: name=tool.name, description=tool.description or '', parameters_json_schema=tool.inputSchema, + strict=self.strict, ) for tool in tools.tools ] @@ -150,6 +152,12 @@ async def main(): If you want to inherit the environment variables from the parent process, use `env=os.environ`. """ + strict: bool | None = None + """Whether to enforce (vendor-specific) strict JSON schema validation for tool calls. + + See [`ToolDefinition`][pydantic_ai.tools.ToolDefinition] for more info. + """ + @asynccontextmanager async def client_streams( self, @@ -220,6 +228,12 @@ async def main(): and may be closed. Defaults to 5 minutes (300 seconds). """ + strict: bool | None = None + """Whether to enforce (vendor-specific) strict JSON schema validation for tool calls. + + See [`ToolDefinition`][pydantic_ai.tools.ToolDefinition] for more info. + """ + @asynccontextmanager async def client_streams( self,