Skip to main content
Glama
nacos-group

Nacos MCP Server

Official
by nacos-group

list_namespaces

Retrieve all namespaces in a Nacos cluster to manage service discovery and configuration access.

Instructions

Retrieves the list of namespaces in the current Nacos cluster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'list_namespaces' tool call: retrieves the Nacos API URL from the tool definition and executes a GET request via NacosServer.get with provided arguments.
    case nacos_tools.NacosToolNames.LIST_NAMESPACES:
        url = nacos_tools.NacosListNamespacesTool().url
        result = nacos.get(name, url, arguments)
        return [types.TextContent(type="text", text=result)]
  • Defines the tool metadata including name 'list_namespaces', description, empty input schema (no parameters required), and the target Nacos API endpoint URL.
    class NacosListNamespacesTool(NacosTool):
        def __init__(self):
            super().__init__(
                name=NacosToolNames.LIST_NAMESPACES,
                description="Retrieves the list of namespaces in the current Nacos cluster.",
                inputSchema={
                    "type": "object",
                    "properties": {}
                },
                url="/nacos/v3/admin/core/namespace/list"
            )
  • Registers the 'list_namespaces' tool by instantiating NacosListNamespacesTool and including it in the list of available tools returned by the MCP server's list_tools method.
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """List available tools"""
        return [
            nacos_tools.NacosListNamespacesTool(),
            nacos_tools.NacosListServices(),
            nacos_tools.NacosGetService(),
            nacos_tools.NacosListInstances(),
            nacos_tools.NacosListServiceSubscribers(),
            nacos_tools.NacosListConfigs(),
            nacos_tools.NacosGetConfig(),
            nacos_tools.NacosListConfigHistory(),
            nacos_tools.NacosGetConfigHistory(),
            nacos_tools.NacosListConfigListeners(),
            nacos_tools.NacosListListenedConfigs(),
        ]
  • Enum definition for the 'list_namespaces' tool name constant used in tool definition and dispatching.
    LIST_NAMESPACES = "list_namespaces",
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Retrieves') but doesn't describe traits like whether it's read-only, paginated, rate-limited, or requires authentication. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the key action ('Retrieves') and resource. There is no wasted wording, and it directly communicates the tool's function without redundancy or fluff, making it highly concise and well-structured.

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 simplicity (0 parameters, no output schema), the description is adequate as a basic read operation. However, without annotations or output schema, it lacks details on behavioral traits (e.g., safety, pagination) and return values. For a list operation in a cluster context, more completeness would be beneficial, but it meets the minimum viable threshold.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here. A baseline of 4 is given since the schema fully handles parameters, and the description doesn't introduce unnecessary information.

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 verb ('Retrieves') and resource ('list of namespaces'), making the purpose unambiguous. It specifies the scope ('in the current Nacos cluster'), which helps distinguish it from generic list operations. However, it doesn't explicitly differentiate from sibling tools like 'list_configs' or 'list_services', which would require a 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing cluster access, or contrast it with sibling tools like 'list_configs' or 'list_services' for namespace-specific operations. Without such context, users must infer usage from the tool name alone.

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/nacos-group/nacos-mcp-server'

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