Skip to main content
Glama
meta.py1.63 kB
from typing import List, Dict, Any from mcp.server.fastmcp import FastMCP def register_meta(mcp: FastMCP, all_tools_info: List[Dict[str, str]]) -> None: """ Registers meta-tools with the MCP server. :param mcp: The MCP server instance. :param all_tools_info: A list of dictionaries with 'name' and 'description' keys for each tool. """ @mcp.tool() async def list_tools() -> Any: """Lists all available tools with their names, descriptions, and total count.""" try: if not all_tools_info: return { "content": [ { "type": "text", "text": "Available tools: No tool information was provided to list_tools." } ] } formatted = [ f"{tool['name']}: {tool.get('description', '')}".strip() for tool in all_tools_info ] return { "content": [ { "type": "text", "text": f"Available tools (total: {len(all_tools_info)}):\n" + "\n".join(formatted) } ], "total_tools": len(all_tools_info) } except Exception as e: return { "isError": True, "content": [ { "type": "text", "text": f"Error listing tools: {str(e)}" } ] }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kiran1689/storyblok-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server