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

Method from_dict

src/mcp_cli/chat/models.py:94–106  ·  view source on GitHub ↗

Create from dict.

(cls, data: dict[str, Any])

Source from the content-addressed store, hash-verified

92
93 @classmethod
94 def from_dict(cls, data: dict[str, Any]) -> "ToolCallData":
95 """Create from dict."""
96 return cls(
97 id=data.get(ToolCallField.ID, ""),
98 type=data.get(ToolCallField.TYPE, "function"),
99 index=data.get(ToolCallField.INDEX, 0),
100 function=FunctionCallData(
101 name=data.get(ToolCallField.FUNCTION, {}).get(ToolCallField.NAME, ""),
102 arguments=data.get(ToolCallField.FUNCTION, {}).get(
103 ToolCallField.ARGUMENTS, ""
104 ),
105 ),
106 )
107
108 def merge_chunk(self, chunk: "ToolCallData") -> None:
109 """Merge data from a streaming chunk into this tool call.

Calls 2

FunctionCallDataClass · 0.85
getMethod · 0.45