Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

UI MCP Test Tool Fix

yuneng-jiang19cacaaed507
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_tools.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_tools.tsx
index 7c24b1b377b..5a971e8b471 100644
--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_tools.tsx
+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_tools.tsx
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { useQuery, useMutation } from "@tanstack/react-query";
import { ToolTestPanel } from "./ToolTestPanel";
-import { MCPTool, MCPToolsViewerProps, CallMCPToolResponse } from "./types";
+import { MCPTool, MCPToolsViewerProps, MCPContent, CallMCPToolResponse } from "./types";
import { listMCPTools, callMCPTool } from "../networking";
import { Card, Title, Text } from "@tremor/react";
@@ -16,7 +16,7 @@ const MCPToolsViewer = ({
serverAlias, // Add serverAlias prop
}: MCPToolsViewerProps) => {
const [selectedTool, setSelectedTool] = useState<MCPTool | null>(null);
- const [toolResult, setToolResult] = useState<CallMCPToolResponse | null>(null);
+ const [toolResult, setToolResult] = useState<MCPContent[] | null>(null);
const [toolError, setToolError] = useState<Error | null>(null);
// Query to fetch MCP tools
@@ -40,14 +40,14 @@ const MCPToolsViewer = ({
if (!accessToken) throw new Error("Access Token required");
try {
- const result = await callMCPTool(accessToken, args.tool.name, args.arguments);
+ const result: CallMCPToolResponse = await callMCPTool(accessToken, args.tool.name, args.arguments);
return result;
} catch (error) {
throw error;
}
},
onSuccess: (data) => {
- setToolResult(data);
+ setToolResult(data.content);
setToolError(null);
},
onError: (error: Error) => {
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/types.tsx b/ui/litellm-dashboard/src/components/mcp_tools/types.tsx
index 6c01ca2e611..fd19a23a8b5 100644
--- a/ui/litellm-dashboard/src/components/mcp_tools/types.tsx
+++ b/ui/litellm-dashboard/src/components/mcp_tools/types.tsx
@@ -110,7 +110,12 @@ export interface MCPEmbeddedResource {
export type MCPContent = MCPTextContent | MCPImageContent | MCPEmbeddedResource;
// Define the response structure for the callMCPTool endpoint
-export type CallMCPToolResponse = MCPContent[];
+export type CallMCPToolResponse = {
+ content: MCPContent[];
+ _meta: any;
+ isError: boolean;
+ structuredContent: any;
+};
// Props for the main component
export interface MCPToolsViewerProps {