list_config_listeners
Retrieve the list of listeners subscribed to a specific configuration in Nacos MCP Server. Specify namespaceId, groupName, dataId, and aggregation to filter results.
Instructions
This interface retrieves the list of listeners subscribed to a specific configuration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| aggregation | No | Whether aggregation from whole cluster, if `false`, only get listeners from requested node, default `true` if missing | |
| dataId | Yes | The dataId of config, Required. | |
| groupName | Yes | The groupName of config, Required. | |
| namespaceId | No | The namespaceId of configs, default is `public` if missing |
Implementation Reference
- src/mcp_server_nacos/server.py:128-131 (handler)Handler logic for the 'list_config_listeners' tool within the call_tool function. It retrieves the tool's URL and executes a GET request to the Nacos API via nacos.get, returning the result as text content.case nacos_tools.NacosToolNames.LIST_CONFIG_LISTENERS: url = nacos_tools.NacosListConfigListeners().url result = nacos.get(name, url, arguments) return [types.TextContent(type="text", text=result)]
- Tool definition class NacosListConfigListeners providing the name, description, input schema (parameters: namespaceId, groupName (required), dataId (required), aggregation), and the Nacos API endpoint URL.class NacosListConfigListeners(NacosTool): def __init__(self): super().__init__( name=NacosToolNames.LIST_CONFIG_LISTENERS, description="This interface retrieves the list of listeners subscribed to a specific configuration.", inputSchema={ "type": "object", "properties": { "namespaceId": {"type": "string", "description": "The namespaceId of configs, default is `public` if missing"}, "groupName": {"type": "string", "description": "The groupName of config, Required."}, "dataId": {"type": "string", "description": "The dataId of config, Required."}, "aggregation": {"type": "bool", "description": "Whether aggregation from whole cluster, if `false`, only get listeners from requested node, default `true` if missing"} }, "required": ["groupName", "dataId"], }, url="/nacos/v3/admin/cs/config/listener" )
- src/mcp_server_nacos/server.py:71-86 (registration)Registration of the tool via server.list_tools() decorator. The function returns a list of all tool instances, including NacosListConfigListeners at line 84.@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 in NacosToolNames for the tool name 'list_config_listeners', used in tool definition and handler matching.LIST_CONFIG_LISTENERS = "list_config_listeners",