mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
render MCP tools on ui logs page
This commit is contained in:
parent
2dfd302a82
commit
759303687a
3 changed files with 22 additions and 1 deletions
|
@ -418,6 +418,7 @@ RESPONSE_FORMAT_TOOL_NAME = "json_tool_call" # default tool name used when conv
|
||||||
|
|
||||||
########################### Logging Callback Constants ###########################
|
########################### Logging Callback Constants ###########################
|
||||||
AZURE_STORAGE_MSFT_VERSION = "2019-07-07"
|
AZURE_STORAGE_MSFT_VERSION = "2019-07-07"
|
||||||
|
MCP_TOOL_NAME_PREFIX = "mcp_tool"
|
||||||
|
|
||||||
########################### LiteLLM Proxy Specific Constants ###########################
|
########################### LiteLLM Proxy Specific Constants ###########################
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
|
@ -11,6 +11,7 @@ from fastapi.responses import StreamingResponse
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from litellm._logging import verbose_logger
|
from litellm._logging import verbose_logger
|
||||||
|
from litellm.constants import MCP_TOOL_NAME_PREFIX
|
||||||
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
|
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
|
||||||
from litellm.proxy._types import UserAPIKeyAuth
|
from litellm.proxy._types import UserAPIKeyAuth
|
||||||
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
|
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
|
||||||
|
@ -139,6 +140,12 @@ if MCP_AVAILABLE:
|
||||||
litellm_logging_obj.model_call_details["mcp_tool_call_metadata"] = (
|
litellm_logging_obj.model_call_details["mcp_tool_call_metadata"] = (
|
||||||
standard_logging_mcp_tool_call
|
standard_logging_mcp_tool_call
|
||||||
)
|
)
|
||||||
|
litellm_logging_obj.model_call_details["model"] = (
|
||||||
|
f"{MCP_TOOL_NAME_PREFIX}: {standard_logging_mcp_tool_call.get('name') or ''}"
|
||||||
|
)
|
||||||
|
litellm_logging_obj.model_call_details["custom_llm_provider"] = (
|
||||||
|
standard_logging_mcp_tool_call.get("mcp_server_name")
|
||||||
|
)
|
||||||
|
|
||||||
# Try managed server tool first
|
# Try managed server tool first
|
||||||
if name in global_mcp_server_manager.tool_name_to_mcp_server_name_mapping:
|
if name in global_mcp_server_manager.tool_name_to_mcp_server_name_mapping:
|
||||||
|
|
|
@ -8,6 +8,19 @@ import { Tooltip } from "antd";
|
||||||
import { TimeCell } from "./time_cell";
|
import { TimeCell } from "./time_cell";
|
||||||
import { Button } from "@tremor/react";
|
import { Button } from "@tremor/react";
|
||||||
|
|
||||||
|
// Helper to get the appropriate logo URL
|
||||||
|
const getLogoUrl = (
|
||||||
|
row: LogEntry,
|
||||||
|
provider: string
|
||||||
|
) => {
|
||||||
|
// Check if mcp_tool_call_metadata exists and contains mcp_server_logo_url
|
||||||
|
if (row.metadata?.mcp_tool_call_metadata?.mcp_server_logo_url) {
|
||||||
|
return row.metadata.mcp_tool_call_metadata.mcp_server_logo_url;
|
||||||
|
}
|
||||||
|
// Fall back to default provider logo
|
||||||
|
return provider ? getProviderLogoAndName(provider).logo : '';
|
||||||
|
};
|
||||||
|
|
||||||
export type LogEntry = {
|
export type LogEntry = {
|
||||||
request_id: string;
|
request_id: string;
|
||||||
api_key: string;
|
api_key: string;
|
||||||
|
@ -177,7 +190,7 @@ export const columns: ColumnDef<LogEntry>[] = [
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
{provider && (
|
{provider && (
|
||||||
<img
|
<img
|
||||||
src={getProviderLogoAndName(provider).logo}
|
src={getLogoUrl(row, provider)}
|
||||||
alt=""
|
alt=""
|
||||||
className="w-4 h-4"
|
className="w-4 h-4"
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue