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
| Name | Required | Description | Default |
|---|---|---|---|
| pageNo | Yes | The current page number, default is 1. | |
| pageSize | Yes | The size of subscribers in each page, default is 100 | |
| namespaceId | No | The namespaceId of service, default is `public` if missing | |
| groupName | No | The groupName pattern of service, default is `DEFAULT_GROUP` if missing | |
| serviceName | Yes | The serviceName pattern of service, required. | |
| aggregation | No | Whether 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" )
- src/mcp_server_nacos/server.py:71-86 (registration)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(), ]
- src/mcp_server_nacos/server.py:108-111 (handler)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",