Skip to content

MCP tools output schema is not propagated to FunctionDeclaration #2828

Closed

Description

@alan-anzenna

Describe the bug
In https://github.com/google/adk-python/blob/main/src/google/adk/tools/mcp_tool/mcp_tool.py#L107, the MCP input schema is passed on to FunctionDeclaration. However, the MCP output schema is not.

To Reproduce
Steps to reproduce the behavior:

  1. Create a LLM agent with a MCP tool added to it that has an output schema.
  2. Ask the LLM to describe the tool's output.

Currently, the LLM replies with something similar to:

The get_a_device tool returns a dictionary object representing a device. However, the specific fields and their descriptions within the dictionary are not provided in the tool's documentation.

Expected behavior

A response such as:

The get_a_device tool returns a GetADeviceResponse object, which contains detailed information about a specific device. The output includes the following attributes:

id: The unique identifier of the device.
...

Desktop (please complete the following information):

  • MacOS
  • Python version(python -V): 3.13.3
  • ADK version(pip show google-adk): 1.11, but verified the code to be unchanged in main as well

Model Information:
gemini-2.5-flash

Additional context

The "success" response above was created by adding the following code:

--- a/patches/mcp_tool.py
+++ b/patches/mcp_tool.py
@@ -108,8 +108,10 @@ class MCPTool(BaseAuthenticatedTool):
         """
         schema_dict = self._mcp_tool.inputSchema
         parameters = _to_gemini_schema(schema_dict)
+        output_schema_dict = self._mcp_tool.outputSchema
+        output_parameters = _to_gemini_schema(output_schema_dict)
         function_decl = FunctionDeclaration(
-            name=self.name, description=self.description, parameters=parameters
+            name=self.name, description=self.description, parameters=parameters, response=output_parameters
         )
         return function_decl

Activity

  1. added
    mcp
    on Sep 2, 2025
  2. added theissue type on Sep 2, 2025
  3. added this to the 10/27 ADK Week milestone on Oct 27, 2025
  4. vishwa180 commented on Oct 27, 2025

    @vishwa180
    Contributor

    Please add me as an assignee, thanks.

  5. vishwa180 commented on Oct 29, 2025

    @vishwa180
    Contributor

    Fixed it in c8e5340

  6. GWeale commented on Oct 29, 2025

    @GWeale
    Collaborator

    @vishwa180 Thank you for closing! Please reopen if you still notice this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

mcp

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions