MCPcopy Create free account
hub / github.com/modelscope/ms-agent / ToolResult

Class ToolResult

ms_agent/llm/utils.py:100–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99@dataclass
100class ToolResult:
101 text: str
102 resources: List[str] = field(default_factory=list)
103 extra: dict = field(default_factory=dict)
104
105 @staticmethod
106 def from_raw(raw):
107 if isinstance(raw, str):
108 return ToolResult(text=raw)
109 if isinstance(raw, dict):
110 return ToolResult(
111 text=str(raw.get('text', '')),
112 resources=raw.get('resources', []),
113 extra={
114 k: v
115 for k, v in raw.items() if k not in ['text', 'resources']
116 })
117 raise TypeError('tool_call_result must be str or dict')

Callers 1

from_rawMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected