@mcp-fe/mcp-worker 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/structured-output.md +484 -0
- package/mcp-service-worker.js +52 -6
- package/mcp-shared-worker.js +52 -6
- package/package.json +1 -1
- package/src/lib/mcp-controller.d.ts +12 -1
- package/src/lib/mcp-controller.d.ts.map +1 -1
- package/src/lib/tool-registry.d.ts.map +1 -1
- package/src/lib/worker-client.d.ts.map +1 -1
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
# Structured Output Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The MCP Worker library supports **structured output** through the `outputSchema` parameter. According to MCP specification, tools with `outputSchema` return **both text and structured versions** of the data, allowing AI models to work with parsed objects directly.
|
|
6
|
+
|
|
7
|
+
## Key Benefits
|
|
8
|
+
|
|
9
|
+
- ✅ **Better AI Understanding**: AI models receive parsed JSON objects in `structuredContent`
|
|
10
|
+
- ✅ **Type Safety**: Define clear schemas for tool outputs using Zod or JSON Schema
|
|
11
|
+
- ✅ **Backward Compatible**: Legacy tools without `outputSchema` continue to work
|
|
12
|
+
- ✅ **Flexible**: Supports simple and complex nested data structures
|
|
13
|
+
- ✅ **MCP Compliant**: Follows official MCP specification format
|
|
14
|
+
|
|
15
|
+
## How It Works (MCP Specification)
|
|
16
|
+
|
|
17
|
+
### Without outputSchema (Legacy Behavior)
|
|
18
|
+
|
|
19
|
+
When `outputSchema` is not defined, the tool returns only text content:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
useMCPTool({
|
|
23
|
+
name: 'get_user',
|
|
24
|
+
inputSchema: { /* ... */ },
|
|
25
|
+
// NO outputSchema
|
|
26
|
+
handler: async () => {
|
|
27
|
+
const data = { name: 'John', email: 'john@example.com' };
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: 'text', text: JSON.stringify(data) }]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Result sent to AI:**
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"content": [
|
|
39
|
+
{
|
|
40
|
+
"type": "text",
|
|
41
|
+
"text": "{\"name\":\"John\",\"email\":\"john@example.com\"}"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### With outputSchema (Structured Output)
|
|
48
|
+
|
|
49
|
+
When `outputSchema` is defined, the handler returns JSON text, and MCPController **automatically adds** `structuredContent`:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
useMCPTool({
|
|
53
|
+
name: 'get_user',
|
|
54
|
+
inputSchema: { /* ... */ },
|
|
55
|
+
outputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
name: { type: 'string' },
|
|
59
|
+
email: { type: 'string' }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
handler: async () => {
|
|
63
|
+
const data = { name: 'John', email: 'john@example.com' };
|
|
64
|
+
// Return as JSON text - MCPController will parse it
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: 'text', text: JSON.stringify(data) }]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Result sent to AI (automatic):**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"content": [
|
|
76
|
+
{
|
|
77
|
+
"type": "text",
|
|
78
|
+
"text": "{\"name\":\"John\",\"email\":\"john@example.com\"}"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"structuredContent": {
|
|
82
|
+
"name": "John",
|
|
83
|
+
"email": "john@example.com"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Key point:** You return text, MCPController adds `structuredContent` automatically!
|
|
89
|
+
|
|
90
|
+
## Usage Examples
|
|
91
|
+
|
|
92
|
+
### Simple Structured Output with Zod
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { useMCPTool } from '@mcp-fe/react-tools';
|
|
96
|
+
import { z } from 'zod';
|
|
97
|
+
|
|
98
|
+
function MyComponent() {
|
|
99
|
+
// Define Zod schema
|
|
100
|
+
const productOutputSchema = z.object({
|
|
101
|
+
id: z.string(),
|
|
102
|
+
name: z.string(),
|
|
103
|
+
price: z.number(),
|
|
104
|
+
inStock: z.boolean(),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
useMCPTool({
|
|
108
|
+
name: 'get_product',
|
|
109
|
+
description: 'Get product information',
|
|
110
|
+
inputSchema: z.object({
|
|
111
|
+
productId: z.string(),
|
|
112
|
+
}).toJSONSchema(),
|
|
113
|
+
outputSchema: productOutputSchema.toJSONSchema(),
|
|
114
|
+
handler: async (args) => {
|
|
115
|
+
const { productId } = args as { productId: string };
|
|
116
|
+
|
|
117
|
+
// Fetch product data
|
|
118
|
+
const product = await fetchProduct(productId);
|
|
119
|
+
|
|
120
|
+
// Return as JSON text
|
|
121
|
+
return {
|
|
122
|
+
content: [{
|
|
123
|
+
type: 'text',
|
|
124
|
+
text: JSON.stringify(product)
|
|
125
|
+
}]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**AI receives:**
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"content": [{ "type": "text", "text": "{\"id\":\"123\",\"name\":\"Laptop\"...}" }],
|
|
136
|
+
"structuredContent": {
|
|
137
|
+
"id": "123",
|
|
138
|
+
"name": "Laptop Pro",
|
|
139
|
+
"price": 1299.99,
|
|
140
|
+
"inStock": true
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Complex Nested Output
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { z } from 'zod';
|
|
149
|
+
|
|
150
|
+
const analyticsOutputSchema = z.object({
|
|
151
|
+
period: z.string(),
|
|
152
|
+
summary: z.object({
|
|
153
|
+
totalVisits: z.number(),
|
|
154
|
+
uniqueVisitors: z.number(),
|
|
155
|
+
}),
|
|
156
|
+
topPages: z.array(z.object({
|
|
157
|
+
path: z.string(),
|
|
158
|
+
views: z.number(),
|
|
159
|
+
})),
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
useMCPTool({
|
|
163
|
+
name: 'get_analytics',
|
|
164
|
+
description: 'Get website analytics',
|
|
165
|
+
inputSchema: z.object({
|
|
166
|
+
period: z.enum(['day', 'week', 'month']),
|
|
167
|
+
}).toJSONSchema(),
|
|
168
|
+
outputSchema: analyticsOutputSchema.toJSONSchema(),
|
|
169
|
+
handler: async (args) => {
|
|
170
|
+
const analytics = await getAnalytics(args);
|
|
171
|
+
|
|
172
|
+
// Return as JSON text
|
|
173
|
+
return {
|
|
174
|
+
content: [{
|
|
175
|
+
type: 'text',
|
|
176
|
+
text: JSON.stringify(analytics)
|
|
177
|
+
}]
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Array Output
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
const usersOutputSchema = z.array(z.object({
|
|
187
|
+
id: z.string(),
|
|
188
|
+
name: z.string(),
|
|
189
|
+
email: z.string(),
|
|
190
|
+
}));
|
|
191
|
+
|
|
192
|
+
useMCPTool({
|
|
193
|
+
name: 'search_users',
|
|
194
|
+
description: 'Search for users',
|
|
195
|
+
inputSchema: z.object({
|
|
196
|
+
query: z.string(),
|
|
197
|
+
}).toJSONSchema(),
|
|
198
|
+
outputSchema: usersOutputSchema.toJSONSchema(),
|
|
199
|
+
handler: async (args) => {
|
|
200
|
+
const users = await searchUsers(args);
|
|
201
|
+
|
|
202
|
+
// Return array as JSON text
|
|
203
|
+
return {
|
|
204
|
+
content: [{
|
|
205
|
+
type: 'text',
|
|
206
|
+
text: JSON.stringify(users)
|
|
207
|
+
}]
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Using with WorkerClient
|
|
214
|
+
|
|
215
|
+
The same functionality works with direct `WorkerClient` usage:
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { workerClient } from '@mcp-fe/mcp-worker';
|
|
219
|
+
|
|
220
|
+
await workerClient.registerTool(
|
|
221
|
+
'get_user',
|
|
222
|
+
'Get user information',
|
|
223
|
+
{
|
|
224
|
+
type: 'object',
|
|
225
|
+
properties: {
|
|
226
|
+
userId: { type: 'string' }
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
async (args) => {
|
|
230
|
+
const user = await fetchUser(args.userId);
|
|
231
|
+
|
|
232
|
+
// Return as JSON text
|
|
233
|
+
return {
|
|
234
|
+
content: [{
|
|
235
|
+
type: 'text',
|
|
236
|
+
text: JSON.stringify(user)
|
|
237
|
+
}]
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
// Define outputSchema in options
|
|
242
|
+
outputSchema: {
|
|
243
|
+
type: 'object',
|
|
244
|
+
properties: {
|
|
245
|
+
id: { type: 'string' },
|
|
246
|
+
name: { type: 'string' },
|
|
247
|
+
email: { type: 'string' }
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Best Practices
|
|
255
|
+
|
|
256
|
+
### 1. Use Zod for Type-Safe Schemas
|
|
257
|
+
|
|
258
|
+
Zod provides better type inference and easier schema definition:
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
import { z } from 'zod';
|
|
262
|
+
|
|
263
|
+
const outputSchema = z.object({
|
|
264
|
+
id: z.string(),
|
|
265
|
+
name: z.string(),
|
|
266
|
+
email: z.string(),
|
|
267
|
+
createdAt: z.string(),
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Use in tool
|
|
271
|
+
outputSchema: outputSchema.toJSONSchema()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 2. Mark Optional Fields
|
|
275
|
+
|
|
276
|
+
Use `.optional()` for fields that may not be present:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
const schema = z.object({
|
|
280
|
+
firstName: z.string().optional(),
|
|
281
|
+
lastName: z.string().optional(),
|
|
282
|
+
email: z.string(), // Required
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### 3. Always Return JSON Text
|
|
287
|
+
|
|
288
|
+
When using `outputSchema`, always return `type: 'text'` with JSON string:
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
// ✅ Correct
|
|
292
|
+
return {
|
|
293
|
+
content: [{
|
|
294
|
+
type: 'text',
|
|
295
|
+
text: JSON.stringify(yourData)
|
|
296
|
+
}]
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// ❌ Incorrect - not JSON
|
|
300
|
+
return {
|
|
301
|
+
content: [{
|
|
302
|
+
type: 'text',
|
|
303
|
+
text: 'Some plain text'
|
|
304
|
+
}]
|
|
305
|
+
};
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 4. Handle Errors Gracefully
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
handler: async (args) => {
|
|
312
|
+
try {
|
|
313
|
+
const data = await fetchData(args);
|
|
314
|
+
return {
|
|
315
|
+
content: [{
|
|
316
|
+
type: 'text',
|
|
317
|
+
text: JSON.stringify(data)
|
|
318
|
+
}]
|
|
319
|
+
};
|
|
320
|
+
} catch (error) {
|
|
321
|
+
// Errors are automatically handled by the framework
|
|
322
|
+
throw new Error(`Failed to fetch data: ${error.message}`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Migration Guide
|
|
328
|
+
|
|
329
|
+
### Migrating Existing Tools
|
|
330
|
+
|
|
331
|
+
If you have existing tools without `outputSchema`, you can add it while keeping the same handler:
|
|
332
|
+
|
|
333
|
+
**Before (Legacy - no outputSchema):**
|
|
334
|
+
```typescript
|
|
335
|
+
useMCPTool({
|
|
336
|
+
name: 'get_data',
|
|
337
|
+
handler: async () => {
|
|
338
|
+
const data = { value: 42 };
|
|
339
|
+
return {
|
|
340
|
+
content: [{
|
|
341
|
+
type: 'text',
|
|
342
|
+
text: JSON.stringify(data)
|
|
343
|
+
}]
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
// AI receives only text
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**After (Structured - with outputSchema):**
|
|
351
|
+
```typescript
|
|
352
|
+
useMCPTool({
|
|
353
|
+
name: 'get_data',
|
|
354
|
+
outputSchema: z.object({
|
|
355
|
+
value: z.number()
|
|
356
|
+
}).toJSONSchema(),
|
|
357
|
+
handler: async () => {
|
|
358
|
+
const data = { value: 42 };
|
|
359
|
+
return {
|
|
360
|
+
content: [{
|
|
361
|
+
type: 'text',
|
|
362
|
+
text: JSON.stringify(data) // Same as before!
|
|
363
|
+
}]
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
// AI receives text + structuredContent automatically
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Key point:** You don't need to change your handler! Just add `outputSchema` and MCPController does the rest.
|
|
371
|
+
|
|
372
|
+
## Implementation Details
|
|
373
|
+
|
|
374
|
+
### Internal Flow
|
|
375
|
+
|
|
376
|
+
1. **Tool Registration**: When a tool is registered with `outputSchema`, the flag is stored in `pendingToolCalls`
|
|
377
|
+
2. **Tool Execution**: Handler runs and returns JSON text in `content`
|
|
378
|
+
3. **Result Processing** (MCPController):
|
|
379
|
+
- If `hasOutputSchema` is true → Parse JSON from `content[0].text` and add as `structuredContent`
|
|
380
|
+
- If `hasOutputSchema` is false → Return only `content` (legacy)
|
|
381
|
+
4. **AI Consumption**: AI model receives:
|
|
382
|
+
- With `outputSchema`: `{ content: [...], structuredContent: {...} }`
|
|
383
|
+
- Without `outputSchema`: `{ content: [...] }`
|
|
384
|
+
|
|
385
|
+
### Automatic Processing
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
// Your handler returns:
|
|
389
|
+
{
|
|
390
|
+
content: [{ type: 'text', text: '{"name":"John","age":30}' }]
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// MCPController automatically adds (when outputSchema is present):
|
|
394
|
+
{
|
|
395
|
+
content: [{ type: 'text', text: '{"name":"John","age":30}' }],
|
|
396
|
+
structuredContent: { name: 'John', age: 30 }
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Type Definitions
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
interface ToolCallResult {
|
|
404
|
+
success: boolean;
|
|
405
|
+
result?: {
|
|
406
|
+
content: Array<{ type: string; text: string }>;
|
|
407
|
+
};
|
|
408
|
+
error?: string;
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
## Examples
|
|
413
|
+
|
|
414
|
+
See complete examples in:
|
|
415
|
+
- [`examples/structured-output.ts`](../examples/structured-output.ts) - WorkerClient examples
|
|
416
|
+
- [`react-tools/docs/examples.md`](../../react-tools/docs/examples.md#structured-output) - React hook examples
|
|
417
|
+
|
|
418
|
+
## Troubleshooting
|
|
419
|
+
|
|
420
|
+
### AI doesn't receive structuredContent
|
|
421
|
+
|
|
422
|
+
**Problem**: Tool has `outputSchema` but AI only receives text.
|
|
423
|
+
|
|
424
|
+
**Solution**: Verify your handler returns valid JSON:
|
|
425
|
+
```typescript
|
|
426
|
+
// ✅ Valid JSON string
|
|
427
|
+
return {
|
|
428
|
+
content: [{
|
|
429
|
+
type: 'text',
|
|
430
|
+
text: JSON.stringify(yourData) // Valid JSON
|
|
431
|
+
}]
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
// ❌ Invalid - not JSON
|
|
435
|
+
return {
|
|
436
|
+
content: [{
|
|
437
|
+
type: 'text',
|
|
438
|
+
text: 'Some plain text' // Can't parse
|
|
439
|
+
}]
|
|
440
|
+
};
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### JSON parse error in MCPController
|
|
444
|
+
|
|
445
|
+
**Problem**: MCPController logs "Failed to parse structured content"
|
|
446
|
+
|
|
447
|
+
**Solution**: Ensure your data is JSON-serializable:
|
|
448
|
+
```typescript
|
|
449
|
+
// ✅ Serializable
|
|
450
|
+
const data = {
|
|
451
|
+
name: 'John',
|
|
452
|
+
date: new Date().toISOString(), // String, not Date object
|
|
453
|
+
value: 42
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// ❌ Not serializable
|
|
457
|
+
const data = {
|
|
458
|
+
name: 'John',
|
|
459
|
+
date: new Date(), // Date object fails JSON.stringify
|
|
460
|
+
func: () => {} // Functions fail
|
|
461
|
+
};
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### TypeScript errors with handler return type
|
|
465
|
+
|
|
466
|
+
**Problem**: TypeScript complains about return type.
|
|
467
|
+
|
|
468
|
+
**Solution**: Handler type expects `{ content: Array<{ type: string; text: string }> }`:
|
|
469
|
+
```typescript
|
|
470
|
+
handler: async (): Promise<{ content: Array<{ type: string; text: string }> }> => {
|
|
471
|
+
return {
|
|
472
|
+
content: [{
|
|
473
|
+
type: 'text',
|
|
474
|
+
text: JSON.stringify(data)
|
|
475
|
+
}]
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## See Also
|
|
481
|
+
|
|
482
|
+
- [Tool Registry Documentation](./api.md#tool-registry)
|
|
483
|
+
- [MCP Specification](https://spec.modelcontextprotocol.io/)
|
|
484
|
+
- [JSON Schema Reference](https://json-schema.org/)
|
package/mcp-service-worker.js
CHANGED
|
@@ -28185,6 +28185,14 @@ var TabManager = class {
|
|
|
28185
28185
|
// libs/mcp-worker/src/lib/mcp-controller.ts
|
|
28186
28186
|
var MAX_RECONNECT_DELAY = 3e4;
|
|
28187
28187
|
var INITIAL_RECONNECT_DELAY = 1e3;
|
|
28188
|
+
function isToolCallResult(obj) {
|
|
28189
|
+
if (typeof obj !== "object" || obj === null)
|
|
28190
|
+
return false;
|
|
28191
|
+
const result = obj;
|
|
28192
|
+
return typeof result["success"] === "boolean" && (result["error"] === void 0 || typeof result["error"] === "string") && (result["result"] === void 0 || typeof result["result"] === "object" && result["result"] !== null && Array.isArray(
|
|
28193
|
+
result["result"]["content"]
|
|
28194
|
+
));
|
|
28195
|
+
}
|
|
28188
28196
|
var MCPController = class _MCPController {
|
|
28189
28197
|
constructor(backendUrl2, broadcastFn, requireAuth = true) {
|
|
28190
28198
|
this.backendUrl = backendUrl2;
|
|
@@ -28481,8 +28489,9 @@ var MCPController = class _MCPController {
|
|
|
28481
28489
|
reject(
|
|
28482
28490
|
new Error(`Tool call timeout: ${name} (tab: ${targetTabId})`)
|
|
28483
28491
|
);
|
|
28484
|
-
}, 3e4)
|
|
28492
|
+
}, 3e4),
|
|
28485
28493
|
// 30 second timeout
|
|
28494
|
+
hasOutputSchema: !!outputSchema
|
|
28486
28495
|
};
|
|
28487
28496
|
this.pendingToolCalls.set(callId, pendingCall);
|
|
28488
28497
|
this.broadcastFn({
|
|
@@ -28490,7 +28499,8 @@ var MCPController = class _MCPController {
|
|
|
28490
28499
|
toolName: name,
|
|
28491
28500
|
args,
|
|
28492
28501
|
callId,
|
|
28493
|
-
targetTabId
|
|
28502
|
+
targetTabId,
|
|
28503
|
+
hasOutputSchema: !!outputSchema
|
|
28494
28504
|
});
|
|
28495
28505
|
});
|
|
28496
28506
|
};
|
|
@@ -28523,11 +28533,40 @@ var MCPController = class _MCPController {
|
|
|
28523
28533
|
}
|
|
28524
28534
|
clearTimeout(pendingCall.timeout);
|
|
28525
28535
|
this.pendingToolCalls.delete(callId);
|
|
28526
|
-
|
|
28527
|
-
|
|
28528
|
-
|
|
28536
|
+
if (result.success && result.result !== void 0) {
|
|
28537
|
+
const contentResult = result.result;
|
|
28538
|
+
if (contentResult?.content && Array.isArray(contentResult.content)) {
|
|
28539
|
+
if (pendingCall.hasOutputSchema) {
|
|
28540
|
+
try {
|
|
28541
|
+
const textContent = contentResult.content.find(
|
|
28542
|
+
(c) => c.type === "text"
|
|
28543
|
+
);
|
|
28544
|
+
if (textContent && textContent.text) {
|
|
28545
|
+
const parsed = JSON.parse(textContent.text);
|
|
28546
|
+
pendingCall.resolve({
|
|
28547
|
+
content: contentResult.content,
|
|
28548
|
+
structuredContent: parsed
|
|
28549
|
+
});
|
|
28550
|
+
return;
|
|
28551
|
+
}
|
|
28552
|
+
} catch (error48) {
|
|
28553
|
+
logger.warn(
|
|
28554
|
+
"[MCPController] Failed to parse structured content:",
|
|
28555
|
+
error48
|
|
28556
|
+
);
|
|
28557
|
+
}
|
|
28558
|
+
}
|
|
28559
|
+
pendingCall.resolve(contentResult);
|
|
28560
|
+
} else {
|
|
28561
|
+
logger.warn(
|
|
28562
|
+
"[MCPController] Result missing content array, serializing"
|
|
28563
|
+
);
|
|
28564
|
+
pendingCall.resolve({
|
|
28565
|
+
content: [{ type: "text", text: JSON.stringify(result.result) }]
|
|
28566
|
+
});
|
|
28567
|
+
}
|
|
28529
28568
|
} else {
|
|
28530
|
-
pendingCall.reject(new Error(
|
|
28569
|
+
pendingCall.reject(new Error(result.error || "Tool call failed"));
|
|
28531
28570
|
}
|
|
28532
28571
|
}
|
|
28533
28572
|
async handleUnregisterTool(toolName, tabId) {
|
|
@@ -28855,6 +28894,13 @@ self.addEventListener("message", async (event) => {
|
|
|
28855
28894
|
logger.warn("[ServiceWorker] TOOL_CALL_RESULT missing callId");
|
|
28856
28895
|
return;
|
|
28857
28896
|
}
|
|
28897
|
+
if (!isToolCallResult(msg)) {
|
|
28898
|
+
logger.error(
|
|
28899
|
+
"[ServiceWorker] Invalid TOOL_CALL_RESULT structure:",
|
|
28900
|
+
msg
|
|
28901
|
+
);
|
|
28902
|
+
return;
|
|
28903
|
+
}
|
|
28858
28904
|
getController().handleToolCallResult(callId, msg);
|
|
28859
28905
|
} catch (error48) {
|
|
28860
28906
|
logger.error("[ServiceWorker] Failed to handle TOOL_CALL_RESULT:", error48);
|
package/mcp-shared-worker.js
CHANGED
|
@@ -28185,6 +28185,14 @@ var TabManager = class {
|
|
|
28185
28185
|
// libs/mcp-worker/src/lib/mcp-controller.ts
|
|
28186
28186
|
var MAX_RECONNECT_DELAY = 3e4;
|
|
28187
28187
|
var INITIAL_RECONNECT_DELAY = 1e3;
|
|
28188
|
+
function isToolCallResult(obj) {
|
|
28189
|
+
if (typeof obj !== "object" || obj === null)
|
|
28190
|
+
return false;
|
|
28191
|
+
const result = obj;
|
|
28192
|
+
return typeof result["success"] === "boolean" && (result["error"] === void 0 || typeof result["error"] === "string") && (result["result"] === void 0 || typeof result["result"] === "object" && result["result"] !== null && Array.isArray(
|
|
28193
|
+
result["result"]["content"]
|
|
28194
|
+
));
|
|
28195
|
+
}
|
|
28188
28196
|
var MCPController = class _MCPController {
|
|
28189
28197
|
constructor(backendUrl2, broadcastFn, requireAuth = true) {
|
|
28190
28198
|
this.backendUrl = backendUrl2;
|
|
@@ -28481,8 +28489,9 @@ var MCPController = class _MCPController {
|
|
|
28481
28489
|
reject(
|
|
28482
28490
|
new Error(`Tool call timeout: ${name} (tab: ${targetTabId})`)
|
|
28483
28491
|
);
|
|
28484
|
-
}, 3e4)
|
|
28492
|
+
}, 3e4),
|
|
28485
28493
|
// 30 second timeout
|
|
28494
|
+
hasOutputSchema: !!outputSchema
|
|
28486
28495
|
};
|
|
28487
28496
|
this.pendingToolCalls.set(callId, pendingCall);
|
|
28488
28497
|
this.broadcastFn({
|
|
@@ -28490,7 +28499,8 @@ var MCPController = class _MCPController {
|
|
|
28490
28499
|
toolName: name,
|
|
28491
28500
|
args,
|
|
28492
28501
|
callId,
|
|
28493
|
-
targetTabId
|
|
28502
|
+
targetTabId,
|
|
28503
|
+
hasOutputSchema: !!outputSchema
|
|
28494
28504
|
});
|
|
28495
28505
|
});
|
|
28496
28506
|
};
|
|
@@ -28523,11 +28533,40 @@ var MCPController = class _MCPController {
|
|
|
28523
28533
|
}
|
|
28524
28534
|
clearTimeout(pendingCall.timeout);
|
|
28525
28535
|
this.pendingToolCalls.delete(callId);
|
|
28526
|
-
|
|
28527
|
-
|
|
28528
|
-
|
|
28536
|
+
if (result.success && result.result !== void 0) {
|
|
28537
|
+
const contentResult = result.result;
|
|
28538
|
+
if (contentResult?.content && Array.isArray(contentResult.content)) {
|
|
28539
|
+
if (pendingCall.hasOutputSchema) {
|
|
28540
|
+
try {
|
|
28541
|
+
const textContent = contentResult.content.find(
|
|
28542
|
+
(c) => c.type === "text"
|
|
28543
|
+
);
|
|
28544
|
+
if (textContent && textContent.text) {
|
|
28545
|
+
const parsed = JSON.parse(textContent.text);
|
|
28546
|
+
pendingCall.resolve({
|
|
28547
|
+
content: contentResult.content,
|
|
28548
|
+
structuredContent: parsed
|
|
28549
|
+
});
|
|
28550
|
+
return;
|
|
28551
|
+
}
|
|
28552
|
+
} catch (error48) {
|
|
28553
|
+
logger.warn(
|
|
28554
|
+
"[MCPController] Failed to parse structured content:",
|
|
28555
|
+
error48
|
|
28556
|
+
);
|
|
28557
|
+
}
|
|
28558
|
+
}
|
|
28559
|
+
pendingCall.resolve(contentResult);
|
|
28560
|
+
} else {
|
|
28561
|
+
logger.warn(
|
|
28562
|
+
"[MCPController] Result missing content array, serializing"
|
|
28563
|
+
);
|
|
28564
|
+
pendingCall.resolve({
|
|
28565
|
+
content: [{ type: "text", text: JSON.stringify(result.result) }]
|
|
28566
|
+
});
|
|
28567
|
+
}
|
|
28529
28568
|
} else {
|
|
28530
|
-
pendingCall.reject(new Error(
|
|
28569
|
+
pendingCall.reject(new Error(result.error || "Tool call failed"));
|
|
28531
28570
|
}
|
|
28532
28571
|
}
|
|
28533
28572
|
async handleUnregisterTool(toolName, tabId) {
|
|
@@ -28863,6 +28902,13 @@ self.onconnect = (event) => {
|
|
|
28863
28902
|
logger.warn("[SharedWorker] TOOL_CALL_RESULT missing callId");
|
|
28864
28903
|
return;
|
|
28865
28904
|
}
|
|
28905
|
+
if (!isToolCallResult(messageData)) {
|
|
28906
|
+
logger.error(
|
|
28907
|
+
"[SharedWorker] Invalid TOOL_CALL_RESULT structure:",
|
|
28908
|
+
messageData
|
|
28909
|
+
);
|
|
28910
|
+
return;
|
|
28911
|
+
}
|
|
28866
28912
|
getController().handleToolCallResult(callId, messageData);
|
|
28867
28913
|
} catch (error48) {
|
|
28868
28914
|
logger.error(
|
package/package.json
CHANGED
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { queryEvents, UserEvent } from './database';
|
|
10
10
|
export type BroadcastFn = (message: unknown) => void;
|
|
11
|
+
export interface ToolCallResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
result?: {
|
|
14
|
+
content: Array<{
|
|
15
|
+
type: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function isToolCallResult(obj: unknown): obj is ToolCallResult;
|
|
11
22
|
export declare class MCPController {
|
|
12
23
|
private backendUrl;
|
|
13
24
|
private broadcastFn;
|
|
@@ -50,7 +61,7 @@ export declare class MCPController {
|
|
|
50
61
|
* @private
|
|
51
62
|
*/
|
|
52
63
|
private handleRegisterToolInternal;
|
|
53
|
-
handleToolCallResult(callId: string, result:
|
|
64
|
+
handleToolCallResult(callId: string, result: ToolCallResult): void;
|
|
54
65
|
handleUnregisterTool(toolName: string, tabId?: string): Promise<boolean>;
|
|
55
66
|
getConnectionStatus(): boolean;
|
|
56
67
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-controller.d.ts","sourceRoot":"","sources":["../../../../../libs/mcp-worker/src/lib/mcp-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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