ChatCompletionsRequest drops MCP tool parameter schemas from parametersJsonSchema
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
🔴 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%)
- Ngôn ngữ chính
- Java
- Star
- 1.7k
- Fork
- 433
- Merge trung bình
- 3 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/adk-java
-
GeminiUtil placeholder user turn ("Continue output. DO NOT look at this line ...") is flagged by prompt injection filtersCó thể đã có người làm @hemasekhar-p đã nhận 2 ngày trước. Đang mởneeds review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
google/adk-java#1628 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[spring-ai] ToolConverter silently drops enum and items from tool parameter schemasCó thể đã có người làm @hirematha đã nhận 5 ngày trước. Đang mởneeds review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
google/adk-java#1609 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[spring-ai] Streaming responses ending with CJK punctuation (。!?) are misclassified as partial and never persisted to the sessionCó thể đã có người làm @hirematha đã nhận 5 ngày trước. Đang mởneeds review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
google/adk-java#1608 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FirestoreSessionService loses event fields on reload, breaking later turns and tool confirmationsCó thể đã có người làm @innoprej đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Claude model throws UnsupportedOperationException("Not supported yet.") on thinking blocks from Claude 5 modelsCó thể đã có người làm @hemasekhar-p đã nhận 2 ngày trước. Đang mởneeds review
google/adk-java#1630 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của google/adk-java
Issue tương tự
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Có thể đã có người làm @dadiyang đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/rocketmq-dashboard#6110 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Python 3.15 supportCó thể đã có người làm @amnesiaof đã nhận hôm nay. Đang mởL: python L: python:uv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dependabot/dependabot-core#16524 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`Processing lsp` never exits and leaves orphaned processesCó thể đã có người làm @overcast302 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
processing/processing4#1578 · 1 bình luận ·
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PlayersCommittee/gemp-swccg-public#1174 ·
Maintainer thường phản hồi trong vòng 2 ngày