fix(ui/): add mcp input as an example for custom code guardrails

This commit is contained in:
Krrish Dholakia 2026-02-06 17:37:20 -08:00
parent e41ecc7a71
commit b77f2e046b
2 changed files with 77 additions and 1 deletions

View file

@ -1113,6 +1113,36 @@
"supports_vision": true,
"tool_use_system_prompt_tokens": 346
},
"au.anthropic.claude-opus-4-6-v1:0": {
"cache_creation_input_token_cost": 6.875e-06,
"cache_creation_input_token_cost_above_200k_tokens": 1.375e-05,
"cache_read_input_token_cost": 5.5e-07,
"cache_read_input_token_cost_above_200k_tokens": 1.1e-06,
"input_cost_per_token": 5.5e-06,
"input_cost_per_token_above_200k_tokens": 1.1e-05,
"litellm_provider": "bedrock_converse",
"max_input_tokens": 200000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 2.75e-05,
"output_cost_per_token_above_200k_tokens": 4.125e-05,
"search_context_cost_per_query": {
"search_context_size_high": 0.01,
"search_context_size_low": 0.01,
"search_context_size_medium": 0.01
},
"supports_assistant_prefill": false,
"supports_computer_use": true,
"supports_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
"tool_use_system_prompt_tokens": 346
},
"anthropic.claude-sonnet-4-20250514-v1:0": {
"cache_creation_input_token_cost": 3.75e-06,
"cache_read_input_token_cost": 3e-07,

View file

@ -233,6 +233,45 @@ const CustomCodeModal: React.FC<CustomCodeModalProps> = ({
structured_messages: [],
model: "gpt-4"
}
},
pre_mcp_call: {
name: "Pre MCP (MCP tool as OpenAI tool)",
data: {
texts: [
"Tool: read_wiki_structure\nArguments: {\"repoName\": \"BerriAI/litellm\"}"
],
images: [],
tools: [
{
type: "function",
function: {
name: "read_wiki_structure",
description: "Read the structure of a GitHub repository (MCP tool passed as OpenAI tool)",
parameters: {
type: "object",
properties: {
repoName: { type: "string", description: "Repository name, e.g. BerriAI/litellm" }
},
required: ["repoName"]
}
}
}
],
tool_calls: [
{
id: "call_mcp_001",
type: "function",
function: {
name: "read_wiki_structure",
arguments: "{\"repoName\": \"BerriAI/litellm\"}"
}
}
],
structured_messages: [
{ role: "user", content: "Tool: read_wiki_structure\nArguments: {\"repoName\": \"BerriAI/litellm\"}" }
],
model: "mcp-tool-call"
}
}
};
@ -597,6 +636,13 @@ const CustomCodeModal: React.FC<CustomCodeModalProps> = ({
>
Pre-call
</button>
<button
type="button"
onClick={() => setTestInput(JSON.stringify(TEST_INPUT_EXAMPLES.pre_mcp_call.data, null, 2))}
className="px-2 py-1 text-xs rounded border border-purple-200 bg-purple-50 text-purple-700 hover:bg-purple-100 transition-colors"
>
Pre MCP
</button>
<button
type="button"
onClick={() => setTestInput(JSON.stringify(TEST_INPUT_EXAMPLES.post_call.data, null, 2))}
@ -610,7 +656,7 @@ const CustomCodeModal: React.FC<CustomCodeModalProps> = ({
<div className="grid grid-cols-2 gap-x-4 gap-y-1">
<div><strong>texts</strong>: Message content (always)</div>
<div><strong>images</strong>: Base64 images (vision)</div>
<div><strong>tools</strong>: Tool definitions <span className="text-orange-600">(pre_call)</span></div>
<div><strong>tools</strong>: Tool definitions <span className="text-orange-600">(pre_call)</span>, MCP as OpenAI tool <span className="text-purple-600">(pre_mcp_call)</span></div>
<div><strong>tool_calls</strong>: LLM tool calls <span className="text-green-600">(post_call)</span></div>
<div><strong>structured_messages</strong>: Full messages <span className="text-orange-600">(pre_call)</span></div>
<div><strong>model</strong>: Model name (always)</div>