import type TamboAI from "@tambo-ai/typescript-sdk"; import React, { PropsWithChildren } from "react"; import type { ComponentRegistry, RegisterToolFn, RegisterToolsFn, TamboComponent, TamboTool, TamboToolRegistry } from "../model/component-metadata.js"; import type { McpServerInfo, NormalizedMcpServerInfo } from "@tambo-ai/client"; import type { ListResourceItem, ResourceSource } from "../model/resource-info.js"; export interface TamboRegistryContext { componentList: ComponentRegistry; toolRegistry: TamboToolRegistry; componentToolAssociations: Record; mcpServerInfos: NormalizedMcpServerInfo[]; resources: ListResourceItem[]; resourceSource: ResourceSource | null; registerComponent: (options: TamboComponent, warnOnOverwrite?: boolean) => void; registerTool: RegisterToolFn; registerTools: RegisterToolsFn; unregisterTools: (names: string[]) => void; addToolAssociation: (componentName: string, tool: TamboTool) => void; registerMcpServer: (info: McpServerInfo) => void; registerMcpServers: (infos: McpServerInfo[]) => void; registerResource: (resource: ListResourceItem) => void; registerResources: (resources: ListResourceItem[]) => void; registerResourceSource: (source: ResourceSource) => void; onCallUnregisteredTool?: (toolName: string, args: TamboAI.ToolCallParameter[]) => Promise; } export declare const TamboRegistryContext: React.Context; export interface TamboRegistryProviderProps { /** The components to register */ components?: TamboComponent[]; /** The tools to register */ tools?: TamboTool[]; /** The MCP servers to register */ mcpServers?: (McpServerInfo | string)[]; /** The static resources to register */ resources?: ListResourceItem[]; /** * Dynamic resource search function. Must be paired with getResource. * Called when useTamboMcpResourceList() is used to fetch resources. */ listResources?: ResourceSource["listResources"]; /** * Dynamic resource fetch function. Must be paired with listResources. * Called when useTamboMcpResource() is used to fetch a specific resource. */ getResource?: ResourceSource["getResource"]; /** * A function to call when an unknown tool is called. If this function is not * provided, an error will be thrown when a tool call is requested by the * server. * * Note that this is generally only for agents, where the agent code may * request tool calls that are not registered in the tool registry. */ onCallUnregisteredTool?: (toolName: string, args: TamboAI.ToolCallParameter[]) => Promise; } /** * The TamboRegistryProvider is a React provider that provides a component * registry to the descendants of the provider. * @param props - The props for the TamboRegistryProvider * @param props.children - The children to wrap * @param props.components - The components to register * @param props.tools - The tools to register * @param props.mcpServers - The MCP servers to register * @param props.resources - The static resources to register * @param props.listResources - The dynamic resource search function (must be paired with getResource) * @param props.getResource - The dynamic resource fetch function (must be paired with listResources) * @param props.onCallUnregisteredTool - The function to call when an unknown tool is called (optional) * @returns The TamboRegistryProvider component */ export declare const TamboRegistryProvider: React.FC>; /** * The useTamboRegistry hook provides access to the component registry * to the descendants of the TamboRegistryProvider. * @returns The component registry */ export declare const useTamboRegistry: () => TamboRegistryContext; /** * Hook to access the MCP server metadata from TamboRegistryProvider. * This provides access to the registered MCP server configurations (metadata only, not connections). * * This hook can be used anywhere within the TamboProvider hierarchy to access * the list of configured MCP servers without needing to be inside TamboMcpProvider. * @returns Array of MCP server metadata * @example * ```tsx * function MyComponent() { * const mcpServers = useTamboMcpServerInfos(); * * return ( *
*

Configured MCP Servers:

* {mcpServers.map((server) => ( *
* {server.name || server.url} *
* ))} *
* ); * } * ``` * * The returned objects are `NormalizedMcpServerInfo` instances, meaning both * `serverKey` and `transport` are always populated (with `transport` * defaulting to HTTP when not explicitly specified). */ export declare const useTamboMcpServerInfos: () => NormalizedMcpServerInfo[]; //# sourceMappingURL=tambo-registry-provider.d.ts.map