Skip to main content
Glama

add_mcp_server

Register a new MCP server with the discovery service to enable tool discovery and execution routing.

Instructions

Register a new MCP server with the discovery service.

Args:
    server_name: Unique name of the server
    server_description: Description of the server
    server_endpoint: Endpoint URL of the server
    tools: List of tools provided by the server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_nameYes
server_descriptionYes
server_endpointYes
toolsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'add_mcp_server' tool. It serializes the provided tools to JSON and calls the discovery_service.add_server method to register the new MCP server, returning the result as JSON.
    @mcp.tool()
    async def add_mcp_server(
        server_name: str, 
        server_description: str, 
        server_endpoint: str, 
        tools: List[Dict[str, Any]]
    ) -> str:
        """
        Register a new MCP server with the discovery service.
        
        Args:
            server_name: Unique name of the server
            server_description: Description of the server
            server_endpoint: Endpoint URL of the server
            tools: List of tools provided by the server
        """
        try:
            # Serialize tools list to JSON string
            tools_json = json.dumps(tools, ensure_ascii=False)
            
            # Add server to discovery service
            result = discovery_service.add_server(
                server_name,
                server_description,
                server_endpoint,
                tools_json
            )
            
            return json.dumps(result, ensure_ascii=False)
        except Exception as e:
            return json.dumps({"error": str(e)}, ensure_ascii=False)
  • Pydantic model defining the input schema for the add_mcp_server tool, matching the function parameters exactly.
    class AddServerRequest(BaseModel):
        server_name: str
        server_description: str
        server_endpoint: str
        tools: List[Dict[str, Any]]
  • mcp_router.py:82-82 (registration)
    The @mcp.tool() decorator registers the add_mcp_server function as an MCP tool on the FastMCP server instance.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Register') but doesn't cover critical aspects like authentication requirements, potential side effects (e.g., if registration is idempotent or destructive), rate limits, or error handling. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a clear purpose statement followed by a bulleted list of parameters. Each sentence earns its place, though the parameter explanations could be slightly more detailed without sacrificing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation with 4 parameters), no annotations, and an output schema present (which reduces the need to describe return values), the description is moderately complete. It covers the basic action and parameters but lacks behavioral context and usage guidelines, making it adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It lists all four parameters with brief explanations (e.g., 'Unique name of the server'), adding basic meaning beyond the schema's titles. However, it doesn't provide details on formats (e.g., URL validation for server_endpoint) or constraints (e.g., uniqueness rules for server_name), leaving some ambiguity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Register') and resource ('new MCP server with the discovery service'), making the purpose evident. However, it doesn't explicitly differentiate this tool from its siblings (exec_mcp_tool and search_mcp_server), which would require mentioning that this is for registration rather than execution or search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like exec_mcp_tool or search_mcp_server. The description lacks context about prerequisites (e.g., whether the server must be pre-configured) or exclusions, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Maverick-LjXuan/mcp-router'

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