MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / mapResponseTools

Method mapResponseTools

src/api/providers/xai.ts:66–85  ·  view source on GitHub ↗

* Convert tools from OpenAI Chat Completions format to Responses API format. * Chat Completions: { type: "function", function: { name, description, parameters } } * Responses API: { type: "function", name, description, parameters } * * Uses base provider's convertToolSchemaForOpenAI() for sc

(tools?: any[])

Source from the content-addressed store, hash-verified

64 * (additionalProperties: false, ensureAllRequired) and handles MCP tools.
65 */
66 private mapResponseTools(tools?: any[]): any[] | undefined {
67 const converted = this.convertToolsForOpenAI(tools)
68 if (!converted?.length) {
69 return undefined
70 }
71 return converted
72 .filter((tool) => tool?.type === "function")
73 .map((tool) => {
74 const isMcp = isMcpTool(tool.function.name)
75 return {
76 type: "function",
77 name: tool.function.name,
78 description: tool.function.description,
79 parameters: isMcp
80 ? tool.function.parameters
81 : this.convertToolSchemaForOpenAI(tool.function.parameters),
82 strict: !isMcp,
83 }
84 })
85 }
86
87 override async *createMessage(
88 systemPrompt: string,

Callers 1

createMessageMethod · 0.95

Calls 1

isMcpToolFunction · 0.90

Tested by

no test coverage detected