|
4 | 4 | from typing import Annotated, Any, TypedDict |
5 | 5 |
|
6 | 6 | import pytest |
| 7 | +from inline_snapshot import snapshot |
7 | 8 | from mcp_types import CallToolResult, TextContent, ToolAnnotations |
8 | 9 | from pydantic import BaseModel, Field |
9 | 10 |
|
@@ -915,17 +916,21 @@ def find_book(query: Annotated[str, Field(title="Search query")], limit: int = 1 |
915 | 916 |
|
916 | 917 | tool = ToolManager().add_tool(find_book) |
917 | 918 |
|
918 | | - assert tool.parameters == { |
919 | | - "type": "object", |
920 | | - "properties": { |
921 | | - "query": {"title": "Search query", "type": "string"}, |
922 | | - "limit": {"default": 10, "type": "integer"}, |
923 | | - }, |
924 | | - "required": ["query"], |
925 | | - } |
926 | | - assert tool.output_schema == { |
927 | | - "type": "object", |
928 | | - "properties": {"name": {"title": "Book title", "type": "string"}, "year": {"type": "integer"}}, |
929 | | - "required": ["name", "year"], |
930 | | - "title": "Book", |
931 | | - } |
| 919 | + assert tool.parameters == snapshot( |
| 920 | + { |
| 921 | + "properties": { |
| 922 | + "query": {"title": "Search query", "type": "string"}, |
| 923 | + "limit": {"default": 10, "type": "integer"}, |
| 924 | + }, |
| 925 | + "required": ["query"], |
| 926 | + "type": "object", |
| 927 | + } |
| 928 | + ) |
| 929 | + assert tool.output_schema == snapshot( |
| 930 | + { |
| 931 | + "properties": {"name": {"title": "Book title", "type": "string"}, "year": {"type": "integer"}}, |
| 932 | + "required": ["name", "year"], |
| 933 | + "title": "Book", |
| 934 | + "type": "object", |
| 935 | + } |
| 936 | + ) |
0 commit comments