MCPcopy Create free account
hub / github.com/anus-dev/ANUS / execute

Method execute

packages/core/src/tools/mcp-tool.ts:130–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128 }
129
130 async execute(): Promise<ToolResult> {
131 const functionCalls: FunctionCall[] = [
132 {
133 name: this.serverToolName,
134 args: this.params,
135 },
136 ];
137
138 const rawResponseParts = await this.mcpTool.callTool(functionCalls);
139
140 // Ensure the response is not an error
141 if (this.isMCPToolError(rawResponseParts)) {
142 throw new Error(
143 `MCP tool '${this.serverToolName}' reported tool error with response: ${JSON.stringify(rawResponseParts)}`,
144 );
145 }
146
147 const transformedParts = transformMcpContentToParts(rawResponseParts);
148
149 return {
150 llmContent: transformedParts,
151 returnDisplay: getStringifiedResultForDisplay(rawResponseParts),
152 };
153 }
154
155 getDescription(): string {
156 return this.displayName;

Callers

nothing calls this directly

Calls 3

isMCPToolErrorMethod · 0.95

Tested by

no test coverage detected