MCPcopy Create free account
hub / github.com/echoVic/blade-code / toOpenAIFunctions

Method toOpenAIFunctions

src/tools/format-converter.ts:50–60  ·  view source on GitHub ↗

* 将项目内部的 ToolDefinition 转换为 OpenAI Functions 格式(旧版)

(toolDefinitions: ToolDefinition[])

Source from the content-addressed store, hash-verified

48 * 将项目内部的 ToolDefinition 转换为 OpenAI Functions 格式(旧版)
49 */
50 static toOpenAIFunctions(toolDefinitions: ToolDefinition[]): OpenAIFunction[] {
51 return toolDefinitions.map(tool => ({
52 name: tool.name,
53 description: tool.description,
54 parameters: {
55 type: 'object',
56 properties: tool.parameters,
57 required: tool.required || [],
58 },
59 }));
60 }
61
62 /**
63 * 将 OpenAI Tools 格式转换为 Functions 格式

Callers 3

Calls

no outgoing calls

Tested by

no test coverage detected