MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / registerApp

Function registerApp

packages/hosts/mcp/src/tool-server.ts:448–476  ·  view source on GitHub ↗
(
    name,
    toolConfig,
    callback,
  )

Source from the content-addressed store, hash-verified

446 };
447
448 const registerApp: ExecutorMcpAssembly<McpServer, McpServerRequestContext>["registerAppTool"] = (
449 name,
450 toolConfig,
451 callback,
452 ) => {
453 const inputSchema = z.object(toolConfig.inputSchema);
454 const metadata = normalizedAppMetadata(toolConfig._meta);
455 if (!sessionful && !config.appsEnabled && visibilityIncludes(metadata, "model")) {
456 const plainMetadata = withoutAppMetadata(metadata);
457 return server.registerTool<z.ZodObject<z.ZodRawShape>, typeof inputSchema>(
458 name,
459 {
460 ...toolConfig,
461 inputSchema,
462 ...(Object.keys(plainMetadata).length === 0
463 ? { _meta: undefined }
464 : { _meta: plainMetadata }),
465 },
466 async (args, context) => toolResult(await callback(args, requestJoinKeys(context))),
467 );
468 }
469
470 return registerAppTool<typeof inputSchema, z.ZodObject<z.ZodRawShape>>(
471 server,
472 name,
473 { ...toolConfig, inputSchema, _meta: metadata },
474 async (args, context) => toolResult(await callback(args, requestJoinKeys(context))),
475 );
476 };
477
478 const nativeInputRequired = async <NativeE extends Cause.YieldableError>(
479 services: NativeExecutionServices<NativeE, McpServerRequestContext>,

Callers

nothing calls this directly

Calls 7

registerAppToolFunction · 0.90
normalizedAppMetadataFunction · 0.85
visibilityIncludesFunction · 0.85
withoutAppMetadataFunction · 0.85
toolResultFunction · 0.85
callbackFunction · 0.85
requestJoinKeysFunction · 0.85

Tested by

no test coverage detected