9
9
10
10
import pydantic
11
11
import pytest
12
- from dirty_equals import IsStr
12
+ from dirty_equals import IsPartialDict
13
+ from inline_snapshot import snapshot
13
14
14
15
import logfire
15
16
from logfire ._internal .exporters .test import TestExporter
19
20
try :
20
21
from agents import Agent , Runner , trace
21
22
from agents .mcp .server import _MCPServerWithClientSession # type: ignore
22
- from inline_snapshot import snapshot
23
23
from mcp import types
24
24
from mcp .server .fastmcp import Context , FastMCP
25
25
from mcp .shared .memory import create_client_server_memory_streams
@@ -103,38 +103,15 @@ def name(self):
103
103
'code.lineno' : 123 ,
104
104
'request' : {
105
105
'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 (),
117
107
},
118
108
'rpc.system' : 'jsonrpc' ,
119
109
'rpc.jsonrpc.version' : '2.0' ,
120
110
'rpc.method' : 'initialize' ,
121
111
'logfire.msg_template' : 'MCP request: initialize' ,
122
112
'logfire.msg' : 'MCP request: initialize' ,
123
113
'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 (),
138
115
},
139
116
},
140
117
{
@@ -162,22 +139,7 @@ def name(self):
162
139
'response' : {
163
140
'meta' : None ,
164
141
'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 ()],
181
143
},
182
144
},
183
145
},
@@ -204,22 +166,7 @@ def name(self):
204
166
'response' : {
205
167
'meta' : None ,
206
168
'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 ()],
223
170
},
224
171
},
225
172
},
@@ -401,22 +348,7 @@ def name(self):
401
348
'response' : {
402
349
'meta' : None ,
403
350
'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 ()],
420
352
},
421
353
},
422
354
},
@@ -440,22 +372,7 @@ def name(self):
440
372
'response' : {
441
373
'meta' : None ,
442
374
'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 ()],
459
376
},
460
377
},
461
378
},
0 commit comments