We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tunamsyar/ollama-mcp-py'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
__init__.py•1.33 KiB
"""
Tools package for MCP server
"""
import importlib
import os
from pathlib import Path
def load_all_tools():
"""Dynamically load all tools from the tools directory."""
tools = {}
tools_dir = Path(__file__).parent
# Find all Python files in the tools directory (except __init__.py)
for file_path in tools_dir.glob("*_tool.py"):
module_name = file_path.stem # Remove .py extension
try:
# Import the module
module = importlib.import_module(f"tools.{module_name}")
# Check if the module has TOOL_INFO
if hasattr(module, 'TOOL_INFO'):
tool_info = module.TOOL_INFO
tools[tool_info["name"]] = tool_info
print(f"✅ Loaded tool: {tool_info['name']}")
else:
print(f"⚠️ {module_name} missing TOOL_INFO")
except Exception as e:
print(f"❌ Failed to load {module_name}: {e}")
return tools
def get_tool_function(tool_name):
"""Get a specific tool function by name."""
tools = load_all_tools()
if tool_name in tools:
return tools[tool_name]["function"]
return None
def list_available_tools():
"""List all available tools with their descriptions."""
tools = load_all_tools()
return {name: info["description"] for name, info in tools.items()}