get_config
Retrieve specific configuration details by providing namespaceId, groupName, and dataId using the Nacos MCP Server interface for efficient configuration management.
Instructions
This interface retrieves the details of the specified configuration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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:116-119 (handler)Handler logic within the MCP @server.call_tool() function specifically for the 'get_config' tool. Retrieves the Nacos API URL from the tool class and executes a GET request using NacosServer.get with the provided arguments.case nacos_tools.NacosToolNames.GET_CONFIG: url = nacos_tools.NacosGetConfig().url result = nacos.get(name, url, arguments) return [types.TextContent(type="text", text=result)]
- Defines the NacosGetConfig tool class, including its name ('get_config'), description, input schema (namespaceId optional, groupName and dataId required), and the target Nacos API URL.class NacosGetConfig(NacosTool): def __init__(self): super().__init__( name=NacosToolNames.GET_CONFIG, description="This interface retrieves the details of the specified 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."} }, "required": ["groupName", "dataId"], }, url="/nacos/v3/admin/cs/config" )
- src/mcp_server_nacos/server.py:71-86 (registration)Registers the NacosGetConfig tool (line 81) among other Nacos tools in the MCP server's list_tools handler.@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:37-46 (helper)Generic helper method in NacosServer class that performs the HTTP GET request to the Nacos API endpoint, used by all tool handlers including get_config.def get(self, name:str, url: str, params: Any = None) -> str: url = f'http://{self.host}:{self.port}{url}' logger.debug(f'GET {url} with params {params}') result = self._request(url, params=params) if result is None: return "Unexpected error: None result handled." if result.is_success(): return str(result.data) return f'Do {name} failed with message: {result.message}'
- src/mcp_server_nacos/nacos_tools.py:268-268 (registration)Enum definition for the tool name 'get_config' in NacosToolNames.GET_CONFIG = "get_config",