1
0
forked from MCP/llm-fusion-mcp
llm-fusion-mcp/test_tools.py
Ryan Malloy c335ba0e1e Initial commit: LLM Fusion MCP Server
- Unified access to 4 major LLM providers (Gemini, OpenAI, Anthropic, Grok)
- Real-time streaming support across all providers
- Multimodal capabilities (text, images, audio)
- Intelligent document processing with smart chunking
- Production-ready with health monitoring and error handling
- Full OpenAI ecosystem integration (Assistants, DALL-E, Whisper)
- Vector embeddings and semantic similarity
- Session-based API key management
- Built with FastMCP and modern Python tooling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 05:47:51 -06:00

52 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Test the MCP tools directly."""
import sys
import os
sys.path.insert(0, 'src')
# Test simple calculator without MCP wrapper
def simple_calculator(operation: str, a: float, b: float):
"""Test version of the calculator tool."""
try:
operations = {
"add": lambda x, y: x + y,
"subtract": lambda x, y: x - y,
"multiply": lambda x, y: x * y,
"divide": lambda x, y: x / y if y != 0 else None
}
if operation.lower() not in operations:
return {
"error": f"Unknown operation: {operation}. Available: {list(operations.keys())}",
"success": False
}
if operation.lower() == "divide" and b == 0:
return {
"error": "Division by zero is not allowed",
"success": False
}
result = operations[operation.lower()](a, b)
return {
"result": result,
"operation": operation,
"operands": [a, b],
"success": True
}
except Exception as e:
return {
"error": str(e),
"success": False
}
if __name__ == "__main__":
print("Testing simple calculator tool:")
print("Add 5 + 3:", simple_calculator('add', 5, 3))
print("Subtract 10 - 3:", simple_calculator('subtract', 10, 3))
print("Multiply 4 * 7:", simple_calculator('multiply', 4, 7))
print("Divide 15 / 3:", simple_calculator('divide', 15, 3))
print("Divide by zero:", simple_calculator('divide', 10, 0))
print("Invalid operation:", simple_calculator('invalid', 1, 2))