Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
fb35d7b
Add --failed-only and --output flags to evals command
Nov 5, 2025
c11a908
Add tests for display_eval_results with --failed-only and --output flags
Nov 5, 2025
19199e7
Add additional test cases for better coverage of display_eval_results
Nov 5, 2025
22d0ecb
Extract filtering logic to testable function and add tests
Nov 5, 2025
9bbb691
Merge branch 'main' into francisco/arcade-cli/updating-evals-to-show-…
jottakka Nov 14, 2025
c293f18
Merge branch 'main' into francisco/arcade-cli/updating-evals-to-show-…
Nov 17, 2025
d593a4a
Adding MCP Servers supports to Arcade Evals
Nov 18, 2025
eda0260
Updating loading from mcp server
Nov 20, 2025
aa1fff9
Merge branch 'main' into francisco/updating-arcade-evails
Nov 26, 2025
2d889f6
Updating to accept headers
Nov 26, 2025
de2df04
fixing linting
Nov 26, 2025
8c5a096
Merge branch 'main' into francisco/arcade-cli/updating-evals-to-show-…
Nov 28, 2025
049f965
added session support for the http loader
torresmateo Nov 28, 2025
3998b39
removed debug print
torresmateo Nov 28, 2025
56399e2
handled unsupported protocol for http tool loader
torresmateo Nov 28, 2025
477ccbe
Open API issue
Nov 28, 2025
5f28a55
Updating strict mode
Nov 28, 2025
bf7678e
Updating strict mode
Nov 28, 2025
baad441
Merge branch 'main' into francisco/arcade-cli/updating-evals-to-show-…
Dec 9, 2025
d28b572
Merge branch 'main' into francisco/updating-arcade-evails
Dec 9, 2025
627bcee
Merge branch 'francisco/arcade-cli/updating-evals-to-show-only-failed…
Dec 9, 2025
4a8c6a5
Merge branch 'main' into francisco/updating-arcade-evails
Dec 13, 2025
dd25223
Merge branch 'main' into francisco/updating-arcade-evails
Dec 15, 2025
823e39d
Merge branch 'main' into francisco/updating-arcade-evails
Dec 16, 2025
6b0a725
updating eval suit to contain all tool sources
Dec 16, 2025
ccfae39
Adding anthropic support
Dec 16, 2025
6318e4a
Adding fuzzy weights
Dec 17, 2025
0ccf790
fix cursor reported bug
Dec 17, 2025
73dc94c
Delete libs/arcade-evals/arcade_evals/_experimental/__init__.py
jottakka Dec 17, 2025
39b7f91
Adding capture mode and smashing some bugs after reviews
jottakka Dec 17, 2025
8b6e17d
fixing output formating when capture mode
jottakka Dec 17, 2025
bbbdbf8
added options to export result to md, txt and html
jottakka Dec 18, 2025
702e2eb
fixing bugs
jottakka Dec 18, 2025
dd1e335
fixes after cursor bot review
jottakka Dec 18, 2025
e4beb77
some updates
jottakka Dec 18, 2025
81006fc
Adding compare mode
jottakka Dec 19, 2025
de0f8e6
Updating evals for multiple models/providers/tracks
jottakka Dec 23, 2025
af916e9
removing self implemented loader and adding flag to override arcade url
jottakka Dec 24, 2025
f38ebbb
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
aaca430
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
27ae785
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
1f3cb55
Fixing html template
jottakka Dec 25, 2025
b5e04aa
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
ead5b13
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
a234574
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
22d9943
Add locks for loading tools from mcp servers only once and avoid conc…
jottakka Dec 25, 2025
b26135c
Fix CLI help tests: strip ANSI codes before assertions
jottakka Dec 25, 2025
b460ac2
adressing some changes after code review
jottakka Dec 29, 2025
e0acb78
updating after erics review
jottakka Jan 4, 2026
524c77d
adding examples
jottakka Jan 5, 2026
5c074d3
fixing ci failing
jottakka Jan 5, 2026
716787d
minor changes
jottakka Jan 5, 2026
435e191
minor fix
jottakka Jan 5, 2026
8c0d677
updates after erics review
jottakka Jan 7, 2026
b9847ad
Merge branch 'main' into francisco/updating-arcade-evails
jottakka Jan 7, 2026
ff8acf9
fixing some linting
jottakka Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
286 changes: 286 additions & 0 deletions examples/composite_mcp_evals_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
"""
Example: Evaluating Tools from Multiple MCP Servers

This example demonstrates how to use CompositeMCPRegistry to evaluate tools
from multiple MCP servers in a single evaluation suite.
"""

from arcade_evals import (
BinaryCritic,
CompositeMCPRegistry,
EvalSuite,
ExpectedToolCall,
MCPToolRegistry,
)

# To load tools automatically from running servers, uncomment:
# github_tools = load_from_stdio(["npx", "-y", "@modelcontextprotocol/server-github"])
# slack_tools = load_from_stdio(["npx", "-y", "@modelcontextprotocol/server-slack"])

# Step 1: Define tool descriptors from multiple MCP servers
# (or use load_from_stdio/load_from_http to load automatically)

calculator_tools = [
{
"name": "add",
"description": "Add two numbers together",
"inputSchema": {
"type": "object",
"properties": {
"a": {"type": "number", "description": "First number"},
"b": {"type": "number", "description": "Second number", "default": 0},
},
"required": ["a"],
},
},
{
"name": "multiply",
"description": "Multiply two numbers together",
"inputSchema": {
"type": "object",
"properties": {
"a": {"type": "number"},
"b": {"type": "number"},
},
"required": ["a", "b"],
},
},
]

string_tools = [
{
"name": "uppercase",
"description": "Convert string to uppercase",
"inputSchema": {
"type": "object",
"properties": {
"text": {"type": "string", "description": "Text to convert"},
},
"required": ["text"],
},
},
{
"name": "reverse",
"description": "Reverse a string",
"inputSchema": {
"type": "object",
"properties": {
"text": {"type": "string", "description": "Text to reverse"},
},
"required": ["text"],
},
},
]

datetime_tools = [
{
"name": "format_date",
"description": "Format a date string",
"inputSchema": {
"type": "object",
"properties": {
"date": {"type": "string"},
"format": {"type": "string", "default": "%Y-%m-%d"},
},
"required": ["date"],
},
},
]

# Step 2: Create a composite registry with tools from multiple servers
# Method 1: Pass tool lists directly (strict_mode=True by default)
composite = CompositeMCPRegistry(
tool_lists={
"calculator": calculator_tools,
"strings": string_tools,
"datetime": datetime_tools,
}
)

# Method 2: Disable strict mode to use original schemas as-is
# composite = CompositeMCPRegistry(
# tool_lists={...},
# strict_mode=False # Schemas not converted, no strict flag in OpenAI tools
# )

print("🎯 Composite MCP Registry Created!")
print(f"Servers: {', '.join(composite.get_server_names())}")
print()

# Step 3: Show how tools are namespaced
print("📋 All Tools (with namespacing):")
tools = composite.list_tools_for_model(tool_format="openai")
for tool in tools:
name = tool["function"]["name"]
desc = tool["function"]["description"]
print(f" - {name}: {desc}")
print()

# Step 4: Create an evaluation suite using the composite registry
suite = EvalSuite(
name="Multi-Server Evaluation Suite",
system_message="You are a helpful assistant with access to calculator, string, and datetime tools.",
catalog=composite,
)

# Step 5: Add test cases using tools from different servers

# Test 1: Calculator server - using fully namespaced name
suite.add_case(
name="Addition with namespace",
user_message="What is 15 plus 7?",
expected_tool_calls=[
ExpectedToolCall(
tool_name="calculator.add", # Fully namespaced
args={"a": 15, "b": 7},
)
],
critics=[
BinaryCritic(critic_field="a", weight=0.5),
BinaryCritic(critic_field="b", weight=0.5),
],
)

# Test 2: String server - using short unique name
suite.add_case(
name="String uppercase",
user_message="Convert 'hello world' to uppercase",
expected_tool_calls=[
ExpectedToolCall(
tool_name="uppercase", # Short name (unique across all servers)
args={"text": "hello world"},
)
],
critics=[
BinaryCritic(critic_field="text", weight=1.0),
],
)

# Test 3: Multiple tool calls from different servers
suite.add_case(
name="Mixed server operations",
user_message="Calculate 10 times 5, then reverse the result",
expected_tool_calls=[
ExpectedToolCall(
tool_name="calculator.multiply",
args={"a": 10, "b": 5},
),
ExpectedToolCall(
tool_name="strings.reverse",
args={"text": "50"},
),
],
critics=[
BinaryCritic(critic_field="a", weight=0.25),
BinaryCritic(critic_field="b", weight=0.25),
BinaryCritic(critic_field="text", weight=0.5),
],
)

# Test 4: Using defaults from schema
suite.add_case(
name="Date formatting with default",
user_message="Format the date 2025-11-18",
expected_tool_calls=[
ExpectedToolCall(
tool_name="datetime.format_date",
args={"date": "2025-11-18"}, # 'format' will use default
)
],
critics=[
BinaryCritic(critic_field="date", weight=1.0),
],
)

# Step 6: Display configured cases
print("✅ Evaluation Suite Configured!")
print(f"Suite: {suite.name}")
print(f"Total cases: {len(suite.cases)}\n")

print("Configured test cases:")
for i, case in enumerate(suite.cases, 1):
print(f"\n{i}. {case.name}")
print(f" Expected {len(case.expected_tool_calls)} tool call(s):")
for tc in case.expected_tool_calls:
print(f" - {tc.name}({tc.args})")

# Step 7: Demonstrate name collision handling
print("\n\n🔍 Name Collision Example:")
print("=" * 60)

# Create two servers with the same tool name
tools_a = [
{
"name": "process",
"description": "Process A",
"inputSchema": {"type": "object", "properties": {}},
}
]
tools_b = [
{
"name": "process",
"description": "Process B",
"inputSchema": {"type": "object", "properties": {}},
}
]

collision_composite = CompositeMCPRegistry(tool_lists={"server_a": tools_a, "server_b": tools_b})

# Short name is ambiguous
try:
collision_composite.resolve_tool_name("process")
except ValueError as e:
print(f"❌ Short name fails: {e}")

# But namespaced names work fine
print(f"✅ Namespaced works: {collision_composite.resolve_tool_name('server_a.process')}")
print(f"✅ Namespaced works: {collision_composite.resolve_tool_name('server_b.process')}")

print("\n\n💡 Key Features:")
print(" • Combine tools from multiple MCP servers")
print(" • Automatic namespacing prevents collisions (server.tool)")
print(" • Short names work when unique across all servers")
print(" • Each server's tools maintain their own schemas and defaults")
print(" • All existing Python tool evaluations still work unchanged")
print(" • strict_mode=True (default) for OpenAI strict mode compliance")

# Step 8: Demonstrate strict_mode option
print("\n\n🔧 Strict Mode Configuration:")
print("=" * 60)

# Show strict mode vs non-strict mode
tool_with_constraints = {
"name": "example",
"description": "Example with schema constraints",
"inputSchema": {
"type": "object",
"properties": {
"count": {"type": "integer", "minimum": 0, "maximum": 100},
"email": {"type": "string", "format": "email"},
},
"required": ["count"],
},
}

# With strict mode (default)
strict_registry = MCPToolRegistry([tool_with_constraints], strict_mode=True)
strict_tools = strict_registry.list_tools_for_model("openai")
print("strict_mode=True:")
print(f" • strict flag: {strict_tools[0]['function'].get('strict')}")
print(
f" • additionalProperties: {strict_tools[0]['function']['parameters'].get('additionalProperties')}"
)
print(" • minimum/format stripped: Yes")

# Without strict mode
non_strict_registry = MCPToolRegistry([tool_with_constraints], strict_mode=False)
non_strict_tools = non_strict_registry.list_tools_for_model("openai")
print("\nstrict_mode=False:")
print(f" • strict flag: {non_strict_tools[0]['function'].get('strict', 'Not set')}")
print(
f" • additionalProperties: {non_strict_tools[0]['function']['parameters'].get('additionalProperties', 'Not set')}"
)
print(" • minimum/format preserved: Yes")

print("\n💡 To run actual evaluations, use:")
print(" results = suite.run(provider_api_key='your-api-key', model='gpt-4')")
50 changes: 50 additions & 0 deletions examples/mcp_connect_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""
Simple example: Connect to MCP servers and create tool registry for evals.

Set environment variables before running:
export ARCADE_API_KEY="arc_..."
export ARCADE_USER_ID="user@example.com"
export GITHUB_TOKEN="ghp_..." # Optional, for GitHub MCP
"""

import os

from arcade_evals import MCPToolRegistry, load_arcade_cloud, load_from_http


def main():
# =========================================================================
# Option 1: Arcade Cloud MCP
# =========================================================================
tools = load_arcade_cloud(
gateway_slug="your-gateway-slug",
# Or pass explicitly:
# arcade_api_key="arc_...",
# arcade_user_id="user@example.com"
)
print(f"Arcade: {len(tools)} tools")

# =========================================================================
# Option 2: GitHub Copilot MCP (or any HTTP MCP with auth headers)
# =========================================================================
github_tools = load_from_http(
url="https://api.githubcopilot.com/mcp/",
headers={
"Authorization": f"Bearer {os.environ.get('GITHUB_TOKEN', '')}",
"Accept": "application/json",
},
)
print(f"GitHub: {len(github_tools)} tools")

# =========================================================================
# Create registry for evals
# =========================================================================
registry = MCPToolRegistry(tools)
openai_tools = registry.list_tools_for_model("openai")
print(f"Registry: {len(openai_tools)} tools ready for evals")

return registry


if __name__ == "__main__":
main()
Loading