Documents
SPEC_ModelContextRegistry
SPEC_ModelContextRegistry
Type
External
Status
Published
Created
Mar 17, 2026
Updated
Mar 17, 2026

ModelContextRegistry#

An imperative API for registering tools and instructions to a model context provider.

const registry = new ModelContextRegistry();

const handle = registry.addTool({
  toolName: "search",
  description: "Search the web",
  parameters: z.object({ query: z.string() }),
  execute: async (args) => {
    return { results: ["..."] };
  },
});

API#

  • addTool(tool: Tool & { toolName: string }): ModelContextRegistryToolHandle
  • addInstruction(instruction: string): ModelContextRegistryInstructionHandle
  • addProvider(provider: ModelContextProvider): ModelContextRegistryProviderHandle

ModelContextRegistryToolHandle#

  • update(tool: Tool & { toolName: string }): void;
  • remove(): void;

ModelContextRegistryInstructionHandle#

  • update(instruction: string): void;
  • remove(): void;

ModelContextRegistryProviderHandle#

  • remove(): void;

ModelContextProvider#

The registry is a ModelContextProvider.