feat: skip empty fields in mcp tool call + improve error handling and response

This commit is contained in:
Siddhant Rai
2025-09-11 19:04:10 +05:30
parent 09b9576eef
commit 641cf5a4c1
8 changed files with 69 additions and 37 deletions

View File

@@ -283,7 +283,14 @@ class MCPTool(Tool):
"""
self._ensure_valid_session()
call_params = {"name": action_name, "arguments": kwargs}
# Skipping empty/None values - letting the server use defaults
cleaned_kwargs = {}
for key, value in kwargs.items():
if value == "" or value is None:
continue
cleaned_kwargs[key] = value
call_params = {"name": action_name, "arguments": cleaned_kwargs}
try:
result = self._make_mcp_request("tools/call", call_params)
return result