mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-16 04:02:55 -06:00
fix: Assign empty inputSchema to MCP tool when converting an ADK tool that wraps a function which takes no parameters.
Fixes https://github.com/google/adk-python/issues/948 PiperOrigin-RevId: 764780248
This commit is contained in:
parent
9bdd813be1
commit
2a65c4118b
@ -12,6 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
@ -41,10 +43,10 @@ def adk_to_mcp_tool_type(tool: BaseTool) -> mcp_types.Tool:
|
|||||||
print(mcp_tool)
|
print(mcp_tool)
|
||||||
"""
|
"""
|
||||||
tool_declaration = tool._get_declaration()
|
tool_declaration = tool._get_declaration()
|
||||||
if not tool_declaration:
|
if not tool_declaration or not tool_declaration.parameters:
|
||||||
input_schema = {}
|
input_schema = {}
|
||||||
else:
|
else:
|
||||||
input_schema = gemini_to_json_schema(tool._get_declaration().parameters)
|
input_schema = gemini_to_json_schema(tool_declaration.parameters)
|
||||||
return mcp_types.Tool(
|
return mcp_types.Tool(
|
||||||
name=tool.name,
|
name=tool.name,
|
||||||
description=tool.description,
|
description=tool.description,
|
||||||
|
Loading…
Reference in New Issue
Block a user