From 2eab9e69bab978852042266d07236ed8a16792ea Mon Sep 17 00:00:00 2001 From: h4ai Date: Wed, 11 Feb 2026 13:24:15 +0800 Subject: [PATCH 1/2] I normalized the tool parameter schema so that any object-type tool input has a properties field, which avoids the Copilot 400: object schema missing properties. --- src/routes/messages/non-stream-translation.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/routes/messages/non-stream-translation.ts b/src/routes/messages/non-stream-translation.ts index dc41e6382..b441e763b 100644 --- a/src/routes/messages/non-stream-translation.ts +++ b/src/routes/messages/non-stream-translation.ts @@ -239,11 +239,26 @@ function translateAnthropicToolsToOpenAI( function: { name: tool.name, description: tool.description, - parameters: tool.input_schema, + parameters: normalizeToolParameters(tool.input_schema), }, })) } +function normalizeToolParameters( + inputSchema: unknown, +): Record { + if (!inputSchema || typeof inputSchema !== "object") { + return { type: "object", properties: {} } + } + + const schema = { ...inputSchema } as Record + if (schema.type === "object" && schema.properties === undefined) { + return { ...schema, properties: {} } + } + + return schema +} + function translateAnthropicToolChoiceToOpenAI( anthropicToolChoice: AnthropicMessagesPayload["tool_choice"], ): ChatCompletionsPayload["tool_choice"] { From ba46aed694ff05a44d2f68b01f6b7bb4207f8cc5 Mon Sep 17 00:00:00 2001 From: h4ai Date: Wed, 11 Feb 2026 14:04:27 +0800 Subject: [PATCH 2/2] Ignore .DS_Store --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 577a4f199..c09c7071c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ node_modules/ .eslintcache # build output -dist/ \ No newline at end of file +dist/.DS_Store