MCPcopy
hub / github.com/CopilotKit/CopilotKit / convertToolsToVercelAITools

Function convertToolsToVercelAITools

packages/runtime/src/agent/index.ts:642–660  ·  view source on GitHub ↗
(
  tools: RunAgentInput["tools"],
)

Source from the content-addressed store, hash-verified

640}
641
642export function convertToolsToVercelAITools(
643 tools: RunAgentInput["tools"],
644): ToolSet {
645 // eslint-disable-next-line @typescript-eslint/no-explicit-any
646 const result: Record<string, any> = {};
647
648 for (const tool of tools) {
649 if (!isJsonSchema(tool.parameters)) {
650 throw new Error(`Invalid JSON schema for tool ${tool.name}`);
651 }
652 const zodSchema = convertJsonSchemaToZodSchema(tool.parameters, true);
653 result[tool.name] = createVercelAISDKTool({
654 description: tool.description,
655 inputSchema: toLanguageModelSchema(zodSchema),
656 });
657 }
658
659 return result;
660}
661
662/**
663 * Check whether a schema is a Zod schema by inspecting its Standard Schema vendor.

Callers 2

utils.test.tsFile · 0.90
runMethod · 0.85

Calls 3

isJsonSchemaFunction · 0.85
toLanguageModelSchemaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…