MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / invoke

Method invoke

src/runtime/tool-invoker.ts:287–319  ·  view source on GitHub ↗
(
    toolName: string,
    args: Record<string, unknown>,
    opts: InvokeOptions,
  )

Source from the content-addressed store, hash-verified

285 constructor(private catalog: ToolCatalog) {}
286
287 async invoke(
288 toolName: string,
289 args: Record<string, unknown>,
290 opts: InvokeOptions,
291 ): Promise<void> {
292 const resolved = this.catalog.resolve(toolName);
293 const session = opts.renderSession ?? createRenderSession('text');
294 const resolvedOpts = { ...opts, renderSession: session };
295
296 if (resolved.ambiguous) {
297 emitExplicitRuntimeError({
298 session,
299 handlerContext: opts.handlerContext,
300 onStructuredOutput: opts.onStructuredOutput,
301 code: 'AMBIGUOUS_TOOL',
302 message: `Ambiguous tool name: Multiple tools match '${toolName}'. Use one of:\n- ${resolved.ambiguous.join('\n- ')}`,
303 });
304 return;
305 }
306
307 if (resolved.notFound || !resolved.tool) {
308 emitExplicitRuntimeError({
309 session,
310 handlerContext: opts.handlerContext,
311 onStructuredOutput: opts.onStructuredOutput,
312 code: 'TOOL_NOT_FOUND',
313 message: `Tool not found: Unknown tool '${toolName}'. Run 'xcodebuildmcp tools' to see available tools.`,
314 });
315 return;
316 }
317
318 return this.executeTool(resolved.tool, args, resolvedOpts);
319 }
320
321 async invokeDirect(
322 tool: ToolDefinition,

Callers

nothing calls this directly

Calls 4

executeToolMethod · 0.95
createRenderSessionFunction · 0.90
emitExplicitRuntimeErrorFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected