MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / registerToolFromManifest

Function registerToolFromManifest

src/utils/tool-registry.ts:297–325  ·  view source on GitHub ↗
(
  toolManifest: ToolManifestEntry,
  toolModule: ImportedToolModule,
)

Source from the content-addressed store, hash-verified

295}
296
297function registerToolFromManifest(
298 toolManifest: ToolManifestEntry,
299 toolModule: ImportedToolModule,
300): void {
301 if (!server) {
302 throw new Error('Tool registry has not been initialized.');
303 }
304
305 const toolName = toolManifest.names.mcp;
306 if (registryState.tools.has(toolName)) {
307 return;
308 }
309
310 const outputSchema = toolManifest.outputSchema
311 ? getMcpOutputSchemaForRegistration(toolManifest.outputSchema)
312 : undefined;
313
314 const registeredTool = server.registerTool(
315 toolName,
316 {
317 description: toolManifest.description ?? '',
318 inputSchema: toolModule.schema,
319 ...(outputSchema ? { outputSchema } : {}),
320 annotations: toolManifest.annotations,
321 },
322 (args: unknown): Promise<ToolResponse> => invokeRegisteredTool(toolName, toolModule, args),
323 );
324 registryState.tools.set(toolName, registeredTool);
325}
326
327function shouldExposeTool(
328 toolManifest: ToolManifestEntry,

Callers 1

Calls 2

invokeRegisteredToolFunction · 0.85

Tested by

no test coverage detected