MCP Tools Integration
Extend your chatbot's capabilities with Model Context Protocol tools
What are MCP Tools?
Model Context Protocol (MCP) tools allow you to extend your chatbot's capabilities beyond simple question-answering. These are custom functions that the LLM can call to perform specific actions, access external APIs, or execute business logic.
ragistry's MCP implementation enables the AI to intelligently decide when to use tools, chain multiple tools together, and integrate their outputs into natural language responses.
Built-in Tools
ragistry comes with several pre-built MCP tools for common use cases:
Database Query Tool
Execute SQL queries against connected databases to fetch real-time data. Supports parameterized queries for security and automatic result formatting.
Search Enhancement Tool
Perform advanced searches with filters, date ranges, and custom relevance scoring. Useful for narrowing down large knowledge bases.
Analytics Tool
Retrieve usage statistics, conversation metrics, and performance data. Enables the chatbot to answer questions about system usage.
External API Tool
Make HTTP requests to external services with authentication, rate limiting, and error handling. Integrate third-party data into responses.
Creating Custom Tools
Build your own MCP tools to handle specific business logic:
from models.mcp_tools import MCPTool
from typing import Dict, Any
class CustomTool(MCPTool):
name = "custom_tool"
description = "Performs a custom action"
async def execute(self, params: Dict[str, Any]):
# Your custom logic here
return {"result": "success"}Tool Management
Configure and manage your MCP tools through the dashboard:
- Enable or disable tools per organization
- Set tool parameters and configuration
- Monitor tool usage and performance
- View tool execution logs and errors
- Test tools with sample inputs
Security & Permissions
MCP tools execute server-side with appropriate security measures:
Authentication
Tools inherit user permissions and can be restricted based on roles
Input Validation
All parameters are validated before execution to prevent injection attacks
Rate Limiting
Prevent abuse with configurable rate limits per tool and organization
Audit Logging
Complete audit trail of tool executions with timestamps and results
Use Cases
E-commerce
Check inventory levels, retrieve product details, process orders, track shipments
Customer Support
Look up customer accounts, check ticket status, escalate issues, send notifications
Internal Tools
Query internal databases, generate reports, schedule tasks, update records
MCP Service Architecture
Tools are managed by the mcp_service.py and mcp_tool_service.py modules, with support for both synchronous and asynchronous execution. The system includes circuit breakers and fallback mechanisms for reliability.