MCPcopy Create free account
hub / github.com/IBM/mcp-cli / _parse_arguments

Method _parse_arguments

src/mcp_cli/chat/tool_processor.py:1248–1263  ·  view source on GitHub ↗

Parse raw arguments into a dictionary.

(self, raw_arguments: Any)

Source from the content-addressed store, hash-verified

1246 return llm_tool_name, raw_arguments, call_id
1247
1248 def _parse_arguments(self, raw_arguments: Any) -> dict[str, Any]:
1249 """Parse raw arguments into a dictionary."""
1250 try:
1251 if isinstance(raw_arguments, str):
1252 if not raw_arguments.strip():
1253 return {}
1254 parsed: dict[str, Any] = json.loads(raw_arguments)
1255 return parsed
1256 result: dict[str, Any] = raw_arguments or {}
1257 return result
1258 except json.JSONDecodeError as e:
1259 logger.warning(f"Invalid JSON in arguments: {e}")
1260 return {}
1261 except Exception as e:
1262 logger.error(f"Error parsing arguments: {e}")
1263 return {}
1264
1265 def _extract_result_value(self, result: Any) -> Any:
1266 """Extract the actual value from MCP response structures.

Callers 8

process_tool_callsMethod · 0.95
test_parse_dictMethod · 0.95
test_parse_noneMethod · 0.95

Calls

no outgoing calls

Tested by 7

test_parse_dictMethod · 0.76
test_parse_noneMethod · 0.76