10000 fix: Assign empty inputSchema to MCP tool when converting an ADK tool… · nx90/adk-python@2a65c41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a65c41

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: Assign empty inputSchema to MCP tool when converting an ADK tool that wraps a function which takes no parameters.
Fixes google#948 PiperOrigin-RevId: 764780248
1 parent 9bdd813 commit 2a65c41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/google/adk/tools/mcp_tool/conversion_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
from typing import Any
1618
from typing import Dict
1719

@@ -41,10 +43,10 @@ def adk_to_mcp_tool_type(tool: BaseTool) -> mcp_types.Tool:
4143
print(mcp_tool)
4244
"""
4345
tool_declaration = tool._get_declaration()
44-
if not tool_declaration:
46+
if not tool_declaration or not tool_declaration.parameters:
4547
input_schema = {}
4648
else:
47-
input_schema = gemini_to_json_schema(tool._get_declaration().parameters)
49+
input_schema = gemini_to_json_schema(tool_declaration.parameters)
4850
return mcp_types.Tool(
4951
name=tool.name,
5052
description=tool.description,

0 commit comments

Comments
 (0)
0