Federico Mariani created CAMEL-23962:
----------------------------------------
Summary: camel-openai: McpToolConverter drops JSON Schema keywords
beyond type/properties/required
Key: CAMEL-23962
URL: https://issues.apache.org/jira/browse/CAMEL-23962
Project: Camel
Issue Type: Bug
Components: camel-openai
Affects Versions: 4.21.0
Reporter: Federico Mariani
{{McpToolConverter.convertTool}} copies only three keys from the MCP tool's
{{inputSchema}} into the OpenAI {{FunctionParameters}}:
{code:java}
paramsBuilder.putAdditionalProperty("type", ...);
... get("properties") ...
... get("required") ...
{code}
Everything else is silently dropped: {{$defs}}/{{definitions}} (referenced by
{{$ref}} inside {{properties}} — the schema sent to the model then contains
dangling references), {{additionalProperties}} (needed for strict function
calling), {{description}}, root-level {{enum}}/{{oneOf}}/{{anyOf}}, etc. MCP
servers with non-trivial tool schemas therefore advertise broken or lossy
schemas to the model, degrading argument quality.
h3. Suggested fix
Copy *all* entries of {{inputSchema}} into {{FunctionParameters}} (defaulting
{{type}} to {{object}} when absent), instead of an allow-list:
{code:java}
for (Map.Entry<String, Object> e : tool.inputSchema().entrySet()) {
paramsBuilder.putAdditionalProperty(e.getKey(),
JsonValue.from(e.getValue()));
}
{code}
_This issue was drafted by Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)