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

Function registerTool

src/index.ts:159–182  ·  view source on GitHub ↗
(tool: ToolDefinition | DefinedPageTool)

Source from the content-addressed store, hash-verified

157 const toolMutex = new Mutex();
158
159 function registerTool(tool: ToolDefinition | DefinedPageTool): void {
160 const toolHandler = new ToolHandler(
161 tool,
162 serverArgs,
163 getContext,
164 toolMutex,
165 );
166
167 if (!toolHandler.shouldRegister) {
168 return;
169 }
170
171 server.registerTool(
172 tool.name,
173 {
174 description: tool.description,
175 inputSchema: toolHandler.registeredInputSchema,
176 annotations: tool.annotations,
177 },
178 async (params): Promise<CallToolResult> => {
179 return await toolHandler.handle(params);
180 },
181 );
182 }
183
184 const tools = createTools(serverArgs);
185 for (const tool of tools) {

Callers 1

createMcpServerFunction · 0.85

Calls 1

handleMethod · 0.95

Tested by

no test coverage detected