MCPcopy Create free account
hub / github.com/OperationT00/T-Code / callToolOutput

Method callToolOutput

src/main/java/com/tcode/mcp/McpClient.java:100–115  ·  view source on GitHub ↗
(String toolName, String argumentsJson)

Source from the content-addressed store, hash-verified

98 }
99
100 public ToolOutput callToolOutput(String toolName, String argumentsJson) throws IOException {
101 JsonNode args;
102 if (argumentsJson == null || argumentsJson.isBlank()) {
103 args = JsonNodeFactory.instance.objectNode();
104 } else {
105 args = MAPPER.readTree(argumentsJson);
106 }
107 ObjectNode params = McpCallToolRequest.toJson(toolName, args);
108 JsonNode result = rpc.request("tools/call", params, 60);
109 McpCallToolResult callResult = MAPPER.treeToValue(result, McpCallToolResult.class);
110 ToolOutput output = callResult.toToolOutput();
111 if (callResult.isError()) {
112 return new ToolOutput("MCP 工具返回错误: " + output.text(), output.imageParts());
113 }
114 return output;
115 }
116
117 public List<McpResourceDescriptor> listResources() throws IOException {
118 try {

Callers 3

callToolMethod · 0.95
invokeMcpToolOutputMethod · 0.80

Calls 4

toJsonMethod · 0.95
toToolOutputMethod · 0.95
textMethod · 0.95
requestMethod · 0.45

Tested by 1