ChatCompletionsRequest drops MCP tool parameter schemas from parametersJsonSchema
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
🔴 Required Information
Describe the Bug:
ADK's native McpToolset is unusable with the native chat-completions connector for MCP tools that take parameters.
AbstractMcpTool declares MCP tool input schemas through FunctionDeclaration.parametersJsonSchema(...), but com.google.adk.models.chat.ChatCompletionsRequest reads only FunctionDeclaration.parameters().
When only the raw JSON schema is populated, the chat-completions path falls back to an empty parameter schema:
{
"type": "object",
"properties": {}
}
As a result, the model receives a parameterless tool declaration for an MCP tool that actually requires arguments and commonly calls the tool with {}.
This appears to be an incompatibility between two first-party core/ ADK components rather than a consumer configuration issue.
Steps to Reproduce:
-
Create an MCP tool with a required parameter, for example:
{ "type": "object", "properties": { "jobId": { "type": "string" } }, "required": ["jobId"] } -
Expose the MCP tool through ADK's native
McpToolset/AbstractMcpTool. -
Use the tool with a model backed by
ChatCompletionsHttpClient. -
Inspect the outbound
/chat/completionsrequest. -
Observe that the generated tool declaration contains an empty parameter schema instead of the MCP tool's JSON schema.
Expected Behavior:
The outbound OpenAI-compatible tool declaration should preserve the MCP tool's parameter schema, including its properties and required fields:
{
"type": "function",
"function": {
"name": "analyze_premerge_failures_by_job",
"parameters": {
"type": "object",
"properties": {
"jobId": {
"type": "string"
}
},
"required": ["jobId"]
}
}
}
The model should therefore be able to identify jobId as a required argument and provide it when calling the tool.
Observed Behavior:
The outbound declaration contains an empty schema:
{
"type": "function",
"function": {
"name": "analyze_premerge_failures_by_job",
"parameters": {
"type": "object",
"properties": {}
}
}
}
The model cannot see that jobId exists and commonly emits an empty argument object:
{}
This prevents parameterized MCP tools from being used correctly through the chat-completions connector.
🟡 Optional Information
Regression:
No known regression has been established. The issue is observed with ADK 1.7.1.
Logs:
The relevant evidence is the outbound /chat/completions request. The tool declaration contains the following schema instead of the MCP-provided schema:
{
"type": "object",
"properties": {}
}
Screenshots / Video:
N/A.
Additional Context:
FunctionDeclaration supports two representations for function parameters:
- typed
parameters(Schema) - raw
parametersJsonSchema(...)
AbstractMcpTool populates the raw parametersJsonSchema form for MCP tool input schemas. ChatCompletionsRequest currently consumes only the typed parameters(Schema) form.
We also observed the same raw-only declaration shape through an application-side MCP adapter, but the native McpToolset reproduction demonstrates that the issue does not depend on that adapter.
A closely related fix already exists for the Claude connector in PR #1342 / commit 760c8da. That fix forwards the raw schema directly, preserving JSON Schema constructs such as $ref and $defs.
OpenAI-compatible chat-completions APIs also accept raw JSON Schema, so forwarding parametersJsonSchema directly appears preferable to converting it into the narrower typed Schema representation.
Impact:
Any parameterized MCP tool is affected when used through the chat-completions connector. In our case, this blocks:
- a tool accepting
jobId - parameterized architecture-analysis MCP tools
Zero-argument tools continue to work because their empty schema is valid.
Temporary Workaround:
Until ADK is fixed, we materialize the raw schemas into typed parameters(Schema) in our BaseLlm implementation before delegating to ChatCompletionsHttpClient.
This workaround is connector-local and is covered by a wire-level regression test.
Minimal Reproduction Code:
A minimal reproduction should consist of:
// Create an MCP tool whose input schema contains a required parameter,
// expose it through the native McpToolset, and invoke it through
// ChatCompletionsHttpClient.
//
// The outbound /chat/completions request contains:
// {
// "type": "object",
// "properties": {}
// }
// instead of the MCP tool's declared schema.
The important distinction is that the MCP tool declaration populates parametersJsonSchema(...), while ChatCompletionsRequest currently reads parameters().
How often has this issue occurred?:
- Always (100%)
- 主要语言
- Java
- 星标
- 1.7k
- 派生
- 433
- 平均合并
- 3 天 13 小时
- 30 天内合并 PR
- 42
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-java 的其他 Issue
-
GeminiUtil placeholder user turn ("Continue output. DO NOT look at this line ...") is flagged by prompt injection filters可能已有人在做 @hemasekhar-p 于 2 天前认领。 未关闭needs review
难度 2/5 1-3 小时 新手友好度 76/100
google/adk-java#1628 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[spring-ai] ToolConverter silently drops enum and items from tool parameter schemas可能已有人在做 @hirematha 于 5 天前认领。 未关闭needs review
难度 2/5 1-3 小时 新手友好度 76/100
google/adk-java#1609 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[spring-ai] Streaming responses ending with CJK punctuation (。!?) are misclassified as partial and never persisted to the session可能已有人在做 @hirematha 于 5 天前认领。 未关闭needs review
难度 2/5 1-3 小时 新手友好度 84/100
google/adk-java#1608 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
FirestoreSessionService compares event timestamps as text, reordering or skipping same-second events未关闭
难度 3/5 1-2 天 新手友好度 50/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
`GET /v1/event/token/{uuid}` can report a BOM upload as done before policy evaluation and metrics have finished可能已有人在做 @Zargath 今天认领。 未关闭defect in triage
难度 2/5 1-3 小时 新手友好度 72/100
DependencyTrack/dependency-track#7646 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
objectionary/eo-graphs#80 ·
-
WebMvcStreamableServerTransportProvider: idle-session eviction stops permanently after a NullPointerException when a session is deleted mid-sweep可能已有人在做 @lejuho 今天认领。 未关闭status: waiting-for-triage
难度 2/5 1-3 小时 新手友好度 72/100
spring-projects/spring-ai#7133 ·
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
objectionary/jucs#141 ·
维护者通常 1 天内回复