functionDeclarationToAnthropicTool ignores parametersJsonSchema, resulting in empty inputSchema for Claude MCP Tools
When using MCP tools with the Claude model via the Google AI Java SDK, the method functionDeclarationToAnthropicTool fails to populate the tool's inputSchema. As a result, the generated Tool object always contains an empty properties map, even though the FunctionDeclaration object includes valid parameter schema data.
This effectively makes MCP tools unusable with Claude because no input schema is delivered to the model.
Actual Behavior
- parameters() is empty → the method skips schema processing
- parametersJsonSchema() contains the real schema but is ignored
- The resulting Tool has an empty inputSchema.properties map
- Claude receives a tool with no arguments → tools cannot be invoked properly
Hi @Cato-Wen, Thank you for reporting this issue. I’ve tested this behavior with the latest version of ADK and I’m currently unable to reproduce the issue you described. Could you please try again using the latest (0.6.0) released version and confirm whether the problem still occurs from your end.
If you are still experiencing this issue, please provide a minimal, complete, and verifiable code example, along with the full error logs and stack trace. This will help us investigate and resolve the problem.
Hi @hemasekhar-p, the issue still exists in ADK Java 1.0.0.
▎ The problem: Claude.functionDeclarationToAnthropicTool() (https://github.com/google/adk-java/blob/main/core/src/main/java/com/google/adk/models/Claude.java) only reads FunctionDeclaration.parameters() but ignores FunctionDeclaration.parametersJsonSchema(). MCP tools populate parametersJsonSchema (not parameters), so their input schema is always empty when sent to Claude.
▎ Debug evidence (ADK 1.0.0, Claude model + BigQuery MCP tools):
▎ Step 1 — llmRequest.config().get().tools().get().get(0).functionDeclarations() shows both ADK-defined tools and MCP tools are present. The difference:
▎ - ADK FunctionTool (works): parameters=Optional[Schema{...properties=Optional[{itemNumber=...}]}], parametersJsonSchema=Optional.empty ▎ - MCP Tool (broken): parameters=Optional.empty, parametersJsonSchema=Optional[JsonSchema[type=object, properties={dataset=..., project=...}]]
▎ Step 2 — After conversion in functionDeclarationToAnthropicTool(), the Anthropic Tool objects sent to Claude API (paramsBuilder.body.tools):
▎ - ADK tool retrievesItemByItemNumber: properties={itemNumber={description=..., type=array}} ✅ ▎ - MCP tool get_dataset_info: properties={} ❌ (empty — schema lost) ▎ - MCP tool execute_sql: properties={} ❌ (empty — schema lost)
▎ Root cause in code — https://github.com/google/adk-java/blob/main/core/src/main/java/com/google/adk/models/Claude.java:
if (functionDeclaration.parameters().isPresent() // MCP tools: Optional.empty → skipped
&& functionDeclaration.parameters().get().properties().isPresent()) {
// ... only processes parameters(), never checks parametersJsonSchema()
}
▎ Suggested fix — add a fallback to parametersJsonSchema() when parameters() is empty:
private Tool functionDeclarationToAnthropicTool(FunctionDeclaration functionDeclaration) {
Map<String, Map<String, Object>> properties = new HashMap<>();
List<String> required = new ArrayList<>();
if (functionDeclaration.parameters().isPresent()
&& functionDeclaration.parameters().get().properties().isPresent()) {
// existing logic for parameters()
functionDeclaration.parameters().get().properties().get().forEach((key, schema) -> {
Map<String, Object> schemaMap = JsonBaseModel.getMapper()
.convertValue(schema, new TypeReference<Map<String, Object>>() {});
updateTypeString(schemaMap);
properties.put(key, schemaMap);
});
functionDeclaration.parameters().get().required().ifPresent(required::addAll);
} else if (functionDeclaration.parametersJsonSchema().isPresent()) {
// fallback for MCP tools that use parametersJsonSchema
JsonSchema jsonSchema = functionDeclaration.parametersJsonSchema().get();
Map<String, Object> schemaMap = JsonBaseModel.getMapper()
.convertValue(jsonSchema, new TypeReference<Map<String, Object>>() {});
if (schemaMap.containsKey("properties")) {
Map<String, Map<String, Object>> props =
(Map<String, Map<String, Object>>) schemaMap.get("properties");
props.forEach((key, value) -> {
updateTypeString(value);
properties.put(key, value);
});
}
if (schemaMap.containsKey("required")) {
required.addAll((List<String>) schemaMap.get("required"));
}
}
Tool.InputSchema.Builder inputSchemaBuilder = Tool.InputSchema.builder()
.properties(JsonValue.from(properties));
if (!required.isEmpty()) {
inputSchemaBuilder.putAdditionalProperty("required", JsonValue.from(required));
}
return Tool.builder()
.name(functionDeclaration.name().orElseThrow())
.description(functionDeclaration.description().orElse(""))
.inputSchema(inputSchemaBuilder.build())
.build();
}
▎ Note: This issue only affects the Claude model path. Gemini model works fine because GeminiUtil passes FunctionDeclaration directly to the Gemini API which handles both formats natively. The Gemini model path also does not exist in ADK Python, so this is Java-only.
▎ Environment: ADK Java 1.0.0, Claude model via Vertex AI (Anthropic SDK), MCP tools from BigQuery MCP server (Streamable HTTP transport).
Minimal reproduction example (ADK Java 1.0.0):
public class ReproduceIssue629 {
public static void main(String[] args) throws Exception {
// 1. Build Claude model via Vertex AI
GoogleCredentials credentials = GoogleCredentials.getApplicationDefault()
.createScoped("https://www.googleapis.com/auth/cloud-platform");
AnthropicClient anthropicClient = AnthropicOkHttpClient.builder()
.maxRetries(2)
.timeout(Duration.ofMinutes(2))
.backend(VertexBackend.builder()
.region("us-east5")
.project("your-gcp-project")
.googleCredentials(credentials)
.build())
.build();
// 2. Load MCP tools (any MCP server with parametersJsonSchema will reproduce this)
StreamableHttpServerParameters mcpParams = StreamableHttpServerParameters.builder()
.url("http://localhost:3000/mcp") // your MCP server URL
.build();
List<BaseTool> mcpTools;
try (McpToolset mcpToolset = new McpToolset(mcpParams)) {
mcpTools = mcpToolset.getTools(null).blockingStream().toList();
}
// 3. Build agent with Claude + MCP tools
LlmAgent agent = LlmAgent.builder()
.name("test_agent")
.model(new Claude("claude-sonnet-4-20250514", anthropicClient))
.instruction("You are a helpful assistant.")
.tools(mcpTools)
.build();
// 4. Run — MCP tools will have empty inputSchema, Claude cannot invoke them
Runner runner = new InMemoryRunner(agent);
var session = runner.sessionService()
.createSession(agent.name(), "user1", null, "session1").blockingGet();
Content userMessage = Content.fromParts(Part.fromText("List all datasets"));
runner.runAsync("user1", session.id(), userMessage, null)
.blockingForEach(event -> {
event.content().ifPresent(c -> c.parts().ifPresent(parts ->
parts.forEach(p -> p.text().ifPresent(System.out::println))));
});
}
}
What happens:
- MCP tools use parametersJsonSchema (not parameters) in their FunctionDeclaration
- Claude.functionDeclarationToAnthropicTool() only checks parameters() → MCP tools get properties={}
- Claude receives tools with no input schema → cannot properly invoke MCP tools
Expected: MCP tool schemas should be converted from parametersJsonSchema when parameters is empty.
Hi @Cato-Wen, Thank you for detailed information and minimal reproduction code. I am able to reproduce this behavior with you minimal repro code that Claude.functionDeclarationToAnthropicTool() function only reads FunctionDeclaration.parameters() and ignores FunctionDeclaration.parametersJsonSchema(). Currently this is under review by our team, we will keep you posted if any updates. thank you.
@anFatum, Please have a look into it.
The issue has been resolved in commit 760c8da and will be part of next release.