Skip to content

Commit bf1c0e8

Browse files
Merge pull request #4 from MicrosoftEdge/fix/idea-board-webmcp-signal-api
Fix WebMCP signal API example
2 parents 187170a + d4a4993 commit bf1c0e8

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

demos/idea-board/index.html

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ <h2>Imperative WebMCP API Reference</h2>
6464
</tr>
6565
</thead>
6666
<tbody>
67-
<tr class="api-group-label"><td colspan="3">registerTool() options</td></tr>
67+
<tr class="api-group-label"><td colspan="3">registerTool(tool, options) &mdash; <code>tool</code> properties</td></tr>
6868
<tr>
6969
<td><code>name</code></td>
7070
<td>String</td>
@@ -85,6 +85,7 @@ <h2>Imperative WebMCP API Reference</h2>
8585
<td>Function</td>
8686
<td>Called when the agent invokes the tool. Receives an object matching <code>inputSchema</code>. Can be sync or async. Return value is sent back to the agent.</td>
8787
</tr>
88+
<tr class="api-group-label"><td colspan="3">registerTool(tool, options) &mdash; <code>options</code> properties</td></tr>
8889
<tr>
8990
<td><code>signal</code></td>
9091
<td>AbortSignal</td>
@@ -274,9 +275,8 @@ <h2>Imperative WebMCP API Reference</h2>
274275
},
275276
required: ['id']
276277
},
277-
execute: ({ id, text, color }) => editSticky(id, text, color),
278-
signal: editController.signal
279-
});
278+
execute: ({ id, text, color }) => editSticky(id, text, color)
279+
}, { signal: editController.signal });
280280
} else if (count === 0 && editController) {
281281
editController.abort();
282282
editController = null;
@@ -289,9 +289,8 @@ <h2>Imperative WebMCP API Reference</h2>
289289
name: 'clear-board',
290290
description: 'Remove all sticky notes from the board.',
291291
inputSchema: { type: 'object', properties: {} },
292-
execute: () => clearBoard(),
293-
signal: clearController.signal
294-
});
292+
execute: () => clearBoard()
293+
}, { signal: clearController.signal });
295294
} else if (count === 0 && clearController) {
296295
clearController.abort();
297296
clearController = null;
@@ -315,9 +314,8 @@ <h2>Imperative WebMCP API Reference</h2>
315314
},
316315
required: ['label', 'stickyIds']
317316
},
318-
execute: ({ label, stickyIds }) => groupStickies(label, stickyIds),
319-
signal: groupController.signal
320-
});
317+
execute: ({ label, stickyIds }) => groupStickies(label, stickyIds)
318+
}, { signal: groupController.signal });
321319
} else if (count < 3 && groupController) {
322320
groupController.abort();
323321
groupController = null;
@@ -418,9 +416,8 @@ <h2>Imperative WebMCP API Reference</h2>
418416
` ${P('name')}: ${S('"edit-sticky"')},`,
419417
` ${P('description')}: ${S('"Edit text or color of a sticky."')},`,
420418
` ${P('inputSchema')}: { ... },`,
421-
` ${P('execute')}: ({ id, text, color }) ${O('=>')} ${F('editSticky')}(id, text, color),`,
422-
` ${P('signal')}: editCtrl.signal ${C('// \u2190 pass the signal')}`,
423-
' });',
419+
` ${P('execute')}: ({ id, text, color }) ${O('=>')} ${F('editSticky')}(id, text, color)`,
420+
` }, { ${P('signal')}: editCtrl.signal }); ${C('// \u2190 pass the signal in options')}`,
424421
'',
425422
` } ${K('else')} ${K('if')} (stickies.length ${O('===')} ${N('0')} ${O('&&')} editCtrl) {`,
426423
` ${C('// Board is empty \u2014 unregister the tool')}`,

0 commit comments

Comments
 (0)