MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / testIncludesWebmcpTools

Function testIncludesWebmcpTools

tests/McpResponse.test.ts:1463–1508  ·  view source on GitHub ↗
(
    t: it.TestContext,
    parseArguments: Partial<ParsedArguments>,
    handlerAction: (
      response: McpResponse,
      context: McpContext,
    ) => Promise<void>,
    toolName: string,
  )

Source from the content-addressed store, hash-verified

1461
1462describe('webmcp', () => {
1463 async function testIncludesWebmcpTools(
1464 t: it.TestContext,
1465 parseArguments: Partial<ParsedArguments>,
1466 handlerAction: (
1467 response: McpResponse,
1468 context: McpContext,
1469 ) => Promise<void>,
1470 toolName: string,
1471 ) {
1472 await withMcpContext(
1473 async (response, context) => {
1474 response.setListWebMcpTools();
1475
1476 await handlerAction(response, context);
1477
1478 const page = context.getSelectedMcpPage().pptrPage;
1479 const {resolve, promise} = Promise.withResolvers();
1480 page.webmcp.once('toolsadded', () => {
1481 resolve(undefined);
1482 });
1483 await page.setContent(
1484 html`<form
1485 toolname="test_tool"
1486 tooldescription="A test tool"
1487 ></form>`,
1488 );
1489 await promise;
1490
1491 const {content, structuredContent} = await response.handle(
1492 toolName,
1493 context,
1494 );
1495 assert.ok(getTextContent(content[0]));
1496 t.assert.snapshot(getTextContent(content[0]));
1497 t.assert.snapshot(
1498 JSON.stringify(
1499 stabilizeStructuredContent(structuredContent),
1500 null,
1501 2,
1502 ),
1503 );
1504 },
1505 {args: ['--enable-features=WebMCP,DevToolsWebMCPSupport']},
1506 parseArguments,
1507 );
1508 }
1509
1510 it('includes webmcp tools in list_pages response', async t => {
1511 await testIncludesWebmcpTools(

Callers 1

Calls 8

withMcpContextFunction · 0.85
resolveFunction · 0.85
htmlFunction · 0.85
getTextContentFunction · 0.85
getSelectedMcpPageMethod · 0.80
setListWebMcpToolsMethod · 0.65
handleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…