Skip to content

Commit 332c0ab

Browse files
authored
Merge pull request #41 from meilisearch/fix/openai-schema-compatibility-issue-27
Fix OpenAI Agent SDK schema compatibility issues (resolves #27)
2 parents 5295eb6 + 7a6d41c commit 332c0ab

File tree

2 files changed

+190
-43
lines changed

2 files changed

+190
-43
lines changed

src/meilisearch_mcp/server.py

Lines changed: 88 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,50 @@ async def handle_list_tools() -> list[types.Tool]:
7272
types.Tool(
7373
name="get-connection-settings",
7474
description="Get current Meilisearch connection settings",
75-
inputSchema={"type": "object", "properties": {}},
75+
inputSchema={
76+
"type": "object",
77+
"properties": {},
78+
"additionalProperties": False,
79+
},
7680
),
7781
types.Tool(
7882
name="update-connection-settings",
7983
description="Update Meilisearch connection settings",
8084
inputSchema={
8185
"type": "object",
8286
"properties": {
83-
"url": {"type": "string", "optional": True},
84-
"api_key": {"type": "string", "optional": True},
87+
"url": {"type": "string"},
88+
"api_key": {"type": "string"},
8589
},
90+
"additionalProperties": False,
8691
},
8792
),
8893
types.Tool(
8994
name="health-check",
9095
description="Check Meilisearch server health",
91-
inputSchema={"type": "object", "properties": {}},
96+
inputSchema={
97+
"type": "object",
98+
"properties": {},
99+
"additionalProperties": False,
100+
},
92101
),
93102
types.Tool(
94103
name="get-version",
95104
description="Get Meilisearch version information",
96-
inputSchema={"type": "object", "properties": {}},
105+
inputSchema={
106+
"type": "object",
107+
"properties": {},
108+
"additionalProperties": False,
109+
},
97110
),
98111
types.Tool(
99112
name="get-stats",
100113
description="Get database statistics",
101-
inputSchema={"type": "object", "properties": {}},
114+
inputSchema={
115+
"type": "object",
116+
"properties": {},
117+
"additionalProperties": False,
118+
},
102119
),
103120
types.Tool(
104121
name="create-index",
@@ -107,15 +124,20 @@ async def handle_list_tools() -> list[types.Tool]:
107124
"type": "object",
108125
"properties": {
109126
"uid": {"type": "string"},
110-
"primaryKey": {"type": "string", "optional": True},
127+
"primaryKey": {"type": "string"},
111128
},
112129
"required": ["uid"],
130+
"additionalProperties": False,
113131
},
114132
),
115133
types.Tool(
116134
name="list-indexes",
117135
description="List all Meilisearch indexes",
118-
inputSchema={"type": "object", "properties": {}},
136+
inputSchema={
137+
"type": "object",
138+
"properties": {},
139+
"additionalProperties": False,
140+
},
119141
),
120142
types.Tool(
121143
name="delete-index",
@@ -124,6 +146,7 @@ async def handle_list_tools() -> list[types.Tool]:
124146
"type": "object",
125147
"properties": {"uid": {"type": "string"}},
126148
"required": ["uid"],
149+
"additionalProperties": False,
127150
},
128151
),
129152
types.Tool(
@@ -133,10 +156,11 @@ async def handle_list_tools() -> list[types.Tool]:
133156
"type": "object",
134157
"properties": {
135158
"indexUid": {"type": "string"},
136-
"offset": {"type": "integer", "optional": True},
137-
"limit": {"type": "integer", "optional": True},
159+
"offset": {"type": "integer"},
160+
"limit": {"type": "integer"},
138161
},
139162
"required": ["indexUid"],
163+
"additionalProperties": False,
140164
},
141165
),
142166
types.Tool(
@@ -146,10 +170,17 @@ async def handle_list_tools() -> list[types.Tool]:
146170
"type": "object",
147171
"properties": {
148172
"indexUid": {"type": "string"},
149-
"documents": {"type": "array", "items": {"type": "object"}},
150-
"primaryKey": {"type": "string", "optional": True},
173+
"documents": {
174+
"type": "array",
175+
"items": {
176+
"type": "object",
177+
"additionalProperties": True,
178+
},
179+
},
180+
"primaryKey": {"type": "string"},
151181
},
152182
"required": ["indexUid", "documents"],
183+
"additionalProperties": False,
153184
},
154185
),
155186
types.Tool(
@@ -159,6 +190,7 @@ async def handle_list_tools() -> list[types.Tool]:
159190
"type": "object",
160191
"properties": {"indexUid": {"type": "string"}},
161192
"required": ["indexUid"],
193+
"additionalProperties": False,
162194
},
163195
),
164196
types.Tool(
@@ -168,9 +200,13 @@ async def handle_list_tools() -> list[types.Tool]:
168200
"type": "object",
169201
"properties": {
170202
"indexUid": {"type": "string"},
171-
"settings": {"type": "object"},
203+
"settings": {
204+
"type": "object",
205+
"additionalProperties": True,
206+
},
172207
},
173208
"required": ["indexUid", "settings"],
209+
"additionalProperties": False,
174210
},
175211
),
176212
types.Tool(
@@ -180,17 +216,17 @@ async def handle_list_tools() -> list[types.Tool]:
180216
"type": "object",
181217
"properties": {
182218
"query": {"type": "string"},
183-
"indexUid": {"type": "string", "optional": True},
184-
"limit": {"type": "integer", "optional": True},
185-
"offset": {"type": "integer", "optional": True},
186-
"filter": {"type": "string", "optional": True},
219+
"indexUid": {"type": "string"},
220+
"limit": {"type": "integer"},
221+
"offset": {"type": "integer"},
222+
"filter": {"type": "string"},
187223
"sort": {
188224
"type": "array",
189225
"items": {"type": "string"},
190-
"optional": True,
191226
},
192227
},
193228
"required": ["query"],
229+
"additionalProperties": False,
194230
},
195231
),
196232
types.Tool(
@@ -200,6 +236,7 @@ async def handle_list_tools() -> list[types.Tool]:
200236
"type": "object",
201237
"properties": {"taskUid": {"type": "integer"}},
202238
"required": ["taskUid"],
239+
"additionalProperties": False,
203240
},
204241
),
205242
types.Tool(
@@ -208,46 +245,41 @@ async def handle_list_tools() -> list[types.Tool]:
208245
inputSchema={
209246
"type": "object",
210247
"properties": {
211-
"limit": {"type": "integer", "optional": True},
212-
"from": {"type": "integer", "optional": True},
213-
"reverse": {"type": "boolean", "optional": True},
248+
"limit": {"type": "integer"},
249+
"from": {"type": "integer"},
250+
"reverse": {"type": "boolean"},
214251
"batchUids": {
215252
"type": "array",
216253
"items": {"type": "string"},
217-
"optional": True,
218254
},
219255
"uids": {
220256
"type": "array",
221257
"items": {"type": "integer"},
222-
"optional": True,
223258
},
224259
"canceledBy": {
225260
"type": "array",
226261
"items": {"type": "string"},
227-
"optional": True,
228262
},
229263
"types": {
230264
"type": "array",
231265
"items": {"type": "string"},
232-
"optional": True,
233266
},
234267
"statuses": {
235268
"type": "array",
236269
"items": {"type": "string"},
237-
"optional": True,
238270
},
239271
"indexUids": {
240272
"type": "array",
241273
"items": {"type": "string"},
242-
"optional": True,
243274
},
244-
"afterEnqueuedAt": {"type": "string", "optional": True},
245-
"beforeEnqueuedAt": {"type": "string", "optional": True},
246-
"afterStartedAt": {"type": "string", "optional": True},
247-
"beforeStartedAt": {"type": "string", "optional": True},
248-
"afterFinishedAt": {"type": "string", "optional": True},
249-
"beforeFinishedAt": {"type": "string", "optional": True},
275+
"afterEnqueuedAt": {"type": "string"},
276+
"beforeEnqueuedAt": {"type": "string"},
277+
"afterStartedAt": {"type": "string"},
278+
"beforeStartedAt": {"type": "string"},
279+
"afterFinishedAt": {"type": "string"},
280+
"beforeFinishedAt": {"type": "string"},
250281
},
282+
"additionalProperties": False,
251283
},
252284
),
253285
types.Tool(
@@ -256,11 +288,12 @@ async def handle_list_tools() -> list[types.Tool]:
256288
inputSchema={
257289
"type": "object",
258290
"properties": {
259-
"uids": {"type": "string", "optional": True},
260-
"indexUids": {"type": "string", "optional": True},
261-
"types": {"type": "string", "optional": True},
262-
"statuses": {"type": "string", "optional": True},
291+
"uids": {"type": "string"},
292+
"indexUids": {"type": "string"},
293+
"types": {"type": "string"},
294+
"statuses": {"type": "string"},
263295
},
296+
"additionalProperties": False,
264297
},
265298
),
266299
types.Tool(
@@ -269,9 +302,10 @@ async def handle_list_tools() -> list[types.Tool]:
269302
inputSchema={
270303
"type": "object",
271304
"properties": {
272-
"offset": {"type": "integer", "optional": True},
273-
"limit": {"type": "integer", "optional": True},
305+
"offset": {"type": "integer"},
306+
"limit": {"type": "integer"},
274307
},
308+
"additionalProperties": False,
275309
},
276310
),
277311
types.Tool(
@@ -280,12 +314,13 @@ async def handle_list_tools() -> list[types.Tool]:
280314
inputSchema={
281315
"type": "object",
282316
"properties": {
283-
"description": {"type": "string", "optional": True},
317+
"description": {"type": "string"},
284318
"actions": {"type": "array", "items": {"type": "string"}},
285319
"indexes": {"type": "array", "items": {"type": "string"}},
286-
"expiresAt": {"type": "string", "optional": True},
320+
"expiresAt": {"type": "string"},
287321
},
288322
"required": ["actions", "indexes"],
323+
"additionalProperties": False,
289324
},
290325
),
291326
types.Tool(
@@ -295,12 +330,17 @@ async def handle_list_tools() -> list[types.Tool]:
295330
"type": "object",
296331
"properties": {"key": {"type": "string"}},
297332
"required": ["key"],
333+
"additionalProperties": False,
298334
},
299335
),
300336
types.Tool(
301337
name="get-health-status",
302338
description="Get comprehensive health status of Meilisearch",
303-
inputSchema={"type": "object", "properties": {}},
339+
inputSchema={
340+
"type": "object",
341+
"properties": {},
342+
"additionalProperties": False,
343+
},
304344
),
305345
types.Tool(
306346
name="get-index-metrics",
@@ -309,12 +349,17 @@ async def handle_list_tools() -> list[types.Tool]:
309349
"type": "object",
310350
"properties": {"indexUid": {"type": "string"}},
311351
"required": ["indexUid"],
352+
"additionalProperties": False,
312353
},
313354
),
314355
types.Tool(
315356
name="get-system-info",
316357
description="Get system-level information",
317-
inputSchema={"type": "object", "properties": {}},
358+
inputSchema={
359+
"type": "object",
360+
"properties": {},
361+
"additionalProperties": False,
362+
},
318363
),
319364
]
320365

0 commit comments

Comments
 (0)