feat: add OPENCLAUDE_DISABLE_STRICT_TOOLS env var to opt out of strict MCP tool schema normalization (#770)

When set, disables strict schema normalization for non-Gemini providers.
Useful for OpenAI-compatible endpoints that reject MCP tools with complex
optional params (e.g. list[dict]) with "Extra required key ... supplied"
errors.
This commit is contained in:
Allan Almeida
2026-04-19 19:45:01 -03:00
committed by GitHub
parent 2c98be7002
commit e6e8d9a248

View File

@@ -607,7 +607,10 @@ function convertTools(
function: {
name: t.name,
description: t.description ?? '',
parameters: normalizeSchemaForOpenAI(schema, !isGemini),
parameters: normalizeSchemaForOpenAI(
schema,
!isGemini && !isEnvTruthy(process.env.OPENCLAUDE_DISABLE_STRICT_TOOLS),
),
},
}
})
@@ -1657,7 +1660,7 @@ class OpenAIShimMessages {
} catch (error) {
throwClassifiedTransportError(error, responsesUrl)
}
if (responsesResponse.ok) {
return responsesResponse
}