MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / evaluate

Function evaluate

tests/network_blocking.test.ts:84–99  ·  view source on GitHub ↗
(
  fn: string,
  response: McpResponse,
  context: McpContext,
  args: ParsedArguments,
)

Source from the content-addressed store, hash-verified

82}
83
84async function evaluate(
85 fn: string,
86 response: McpResponse,
87 context: McpContext,
88 args: ParsedArguments,
89): Promise<unknown> {
90 response.resetResponseLineForTesting();
91 await evaluateScript(args).handler(
92 {params: {function: fn}},
93 response,
94 context,
95 );
96 const line = response.responseLines.at(2);
97 assert.ok(line, `unexpected response: ${response.responseLines.join('\n')}`);
98 return line === 'undefined' ? undefined : JSON.parse(line);
99}
100
101/**
102 * Fetches `url` from the selected page and returns the outcome. The timeout

Callers 4

fetchFromPageFunction · 0.85
tools.test.tsFile · 0.85

Calls 3

parseMethod · 0.80
handlerMethod · 0.65

Tested by

no test coverage detected