99
1010import pydantic
1111import pytest
12- from dirty_equals import IsStr
12+ from dirty_equals import IsPartialDict
13+ from inline_snapshot import snapshot
1314
1415import logfire
1516from logfire ._internal .exporters .test import TestExporter
1920try :
2021 from agents import Agent , Runner , trace
2122 from agents .mcp .server import _MCPServerWithClientSession # type: ignore
22- from inline_snapshot import snapshot
2323 from mcp import types
2424 from mcp .server .fastmcp import Context , FastMCP
2525 from mcp .shared .memory import create_client_server_memory_streams
@@ -103,38 +103,15 @@ def name(self):
103103 'code.lineno' : 123 ,
104104 'request' : {
105105 'method' : 'initialize' ,
106- 'params' : {
107- 'meta' : None ,
108- 'protocolVersion' : IsStr (),
109- 'capabilities' : {
110- 'experimental' : None ,
111- 'sampling' : None ,
112- 'elicitation' : None ,
113- 'roots' : None ,
114- },
115- 'clientInfo' : {'name' : 'mcp' , 'title' : None , 'version' : '0.1.0' },
116- },
106+ 'params' : IsPartialDict (),
117107 },
118108 'rpc.system' : 'jsonrpc' ,
119109 'rpc.jsonrpc.version' : '2.0' ,
120110 'rpc.method' : 'initialize' ,
121111 'logfire.msg_template' : 'MCP request: initialize' ,
122112 'logfire.msg' : 'MCP request: initialize' ,
123113 'logfire.span_type' : 'span' ,
124- 'response' : {
125- 'meta' : None ,
126- 'protocolVersion' : IsStr (),
127- 'capabilities' : {
128- 'experimental' : {},
129- 'logging' : None ,
130- 'prompts' : {'listChanged' : False },
131- 'resources' : {'subscribe' : False , 'listChanged' : False },
132- 'tools' : {'listChanged' : False },
133- 'completions' : None ,
134- },
135- 'serverInfo' : {'name' : 'FastMCP' , 'title' : None , 'version' : IsStr ()},
136- 'instructions' : None ,
137- },
114+ 'response' : IsPartialDict (),
138115 },
139116 },
140117 {
@@ -162,22 +139,7 @@ def name(self):
162139 'response' : {
163140 'meta' : None ,
164141 'nextCursor' : None ,
165- 'tools' : [
166- {
167- 'name' : 'random_number' ,
168- 'title' : None ,
169- 'description' : '' ,
170- 'inputSchema' : {'properties' : {}, 'title' : 'random_numberArguments' , 'type' : 'object' },
171- 'outputSchema' : {
172- 'properties' : {'result' : {'title' : 'Result' , 'type' : 'integer' }},
173- 'required' : ['result' ],
174- 'title' : 'random_numberOutput' ,
175- 'type' : 'object' ,
176- },
177- 'annotations' : None ,
178- 'meta' : None ,
179- }
180- ],
142+ 'tools' : [IsPartialDict ()],
181143 },
182144 },
183145 },
@@ -204,22 +166,7 @@ def name(self):
204166 'response' : {
205167 'meta' : None ,
206168 'nextCursor' : None ,
207- 'tools' : [
208- {
209- 'name' : 'random_number' ,
210- 'title' : None ,
211- 'description' : '' ,
212- 'inputSchema' : {'properties' : {}, 'title' : 'random_numberArguments' , 'type' : 'object' },
213- 'outputSchema' : {
214- 'properties' : {'result' : {'title' : 'Result' , 'type' : 'integer' }},
215- 'required' : ['result' ],
216- 'title' : 'random_numberOutput' ,
217- 'type' : 'object' ,
218- },
219- 'annotations' : None ,
220- 'meta' : None ,
221- }
222- ],
169+ 'tools' : [IsPartialDict ()],
223170 },
224171 },
225172 },
@@ -401,22 +348,7 @@ def name(self):
401348 'response' : {
402349 'meta' : None ,
403350 'nextCursor' : None ,
404- 'tools' : [
405- {
406- 'name' : 'random_number' ,
407- 'title' : None ,
408- 'description' : '' ,
409- 'inputSchema' : {'properties' : {}, 'title' : 'random_numberArguments' , 'type' : 'object' },
410- 'outputSchema' : {
411- 'properties' : {'result' : {'title' : 'Result' , 'type' : 'integer' }},
412- 'required' : ['result' ],
413- 'title' : 'random_numberOutput' ,
414- 'type' : 'object' ,
415- },
416- 'annotations' : None ,
417- 'meta' : None ,
418- }
419- ],
351+ 'tools' : [IsPartialDict ()],
420352 },
421353 },
422354 },
@@ -440,22 +372,7 @@ def name(self):
440372 'response' : {
441373 'meta' : None ,
442374 'nextCursor' : None ,
443- 'tools' : [
444- {
445- 'name' : 'random_number' ,
446- 'title' : None ,
447- 'description' : '' ,
448- 'inputSchema' : {'properties' : {}, 'title' : 'random_numberArguments' , 'type' : 'object' },
449- 'outputSchema' : {
450- 'properties' : {'result' : {'title' : 'Result' , 'type' : 'integer' }},
451- 'required' : ['result' ],
452- 'title' : 'random_numberOutput' ,
453- 'type' : 'object' ,
454- },
455- 'annotations' : None ,
456- 'meta' : None ,
457- }
458- ],
375+ 'tools' : [IsPartialDict ()],
459376 },
460377 },
461378 },
0 commit comments