Skip to main content
Glama
nacos-group

Nacos MCP Server

Official
by nacos-group

list_service_subscribers

Retrieve subscribers for a specified service in Nacos to monitor service dependencies and client connections.

Instructions

This interface retrieves the list of subscribers for a specified service.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoYesThe current page number, default is 1.
pageSizeYesThe size of subscribers in each page, default is 100
namespaceIdNoThe namespaceId of service, default is `public` if missing
groupNameNoThe groupName pattern of service, default is `DEFAULT_GROUP` if missing
serviceNameYesThe serviceName pattern of service, required.
aggregationNoWhether aggregation from whole cluster, if `false`, only get subscribers from requested node, default `true` if missing

Implementation Reference

  • The NacosListServiceSubscribers class implements the tool by defining its name, description, input schema, and the Nacos API endpoint URL used for execution.
    class NacosListServiceSubscribers(NacosTool):
        def __init__(self):
            super().__init__(
                name=NacosToolNames.LIST_SERVICE_SUBSCRIBERS,
                description="This interface retrieves the list of subscribers for a specified service.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "pageNo": {"type": "int", "description": "The current page number, default is 1."},
                        "pageSize": {"type": "int", "description": "The size of subscribers in each page, default is 100"},
                        "namespaceId": {"type": "string",
                                        "description": "The namespaceId of service, default is `public` if missing"},
                        "groupName": {"type": "string",
                                      "description": "The groupName pattern of service, default is `DEFAULT_GROUP` if missing"},
                        "serviceName": {"type": "string",
                                        "description": "The serviceName pattern of service, required."},
                        "aggregation": {"type": "bool",
                                        "description": "Whether aggregation from whole cluster, if `false`, only get subscribers from requested node, default `true` if missing"}
                    },
                    "required": ["pageNo", "pageSize", "serviceName"],
                },
                url="/nacos/v3/admin/ns/service/subscribers"
            )
  • Tool registration in the MCP server's list_tools decorator, instantiating and returning NacosListServiceSubscribers among other tools.
    @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(),
        ]
  • Execution handler in the call_tool function that matches the tool name, retrieves the URL from the tool instance, calls the Nacos server, and returns the result.
    case nacos_tools.NacosToolNames.LIST_SERVICE_SUBSCRIBERS:
        url = nacos_tools.NacosListServiceSubscribers().url
        result = nacos.get(name, url, arguments)
        return [types.TextContent(type="text", text=result)]
  • Enum value defining the exact string name 'list_service_subscribers' for the tool.
    LIST_SERVICE_SUBSCRIBERS = "list_service_subscribers",

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