Skip to main content
Glama
nacos-group

Nacos MCP Server

Official
by nacos-group

get_service

Retrieve detailed service information including metadata and clusters from Nacos service discovery, without instance lists.

Instructions

This interface retrieves detailed information of a specified service, including metadata and clusters, not including instance list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceIdNoThe namespaceId of services, default is `public` if missing
groupNameNoThe groupName pattern of services, default is `DEFAULT_GROUP` if missing
serviceNameYesThe serviceName pattern of services, required.

Implementation Reference

  • Core implementation of the 'get_service' tool via the NacosGetService class, which defines the tool name, input schema, description, and the specific Nacos API endpoint URL for retrieving service details.
    class NacosGetService(NacosTool):
        def __init__(self):
            super().__init__(
                name=NacosToolNames.GET_SERVICE,
                description="This interface retrieves detailed information of a specified service, including metadata and clusters, not including instance list.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "namespaceId": {"type": "string",
                                        "description": "The namespaceId of services, default is `public` if missing"},
                        "groupName": {"type": "string",
                                      "description": "The groupName pattern of services, default is `DEFAULT_GROUP` if missing"},
                        "serviceName": {"type": "string",
                                        "description": "The serviceName pattern of services, required."}
                    },
                    "required": ["serviceName"],
                },
                url="/nacos/v3/admin/ns/service"
            )
  • Registers the NacosGetService tool (get_service) among the list of available tools returned by the list_tools handler.
    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(),
    ]
  • Dispatch handler in call_tool function that executes the get_service tool by fetching its URL and invoking the shared Nacos GET request method with provided arguments.
    case nacos_tools.NacosToolNames.GET_SERVICE:
        url = nacos_tools.NacosGetService().url
        result = nacos.get(name, url, arguments)
        return [types.TextContent(type="text", text=result)]
  • Enum definition mapping GET_SERVICE to the tool name string 'get_service' used for registration and dispatch.
    GET_SERVICE = "get_service",
  • Input schema definition for the get_service tool, specifying parameters namespaceId, groupName, and required serviceName.
    inputSchema={
        "type": "object",
        "properties": {
            "namespaceId": {"type": "string",
                            "description": "The namespaceId of services, default is `public` if missing"},
            "groupName": {"type": "string",
                          "description": "The groupName pattern of services, default is `DEFAULT_GROUP` if missing"},
            "serviceName": {"type": "string",
                            "description": "The serviceName pattern of services, required."}
        },
        "required": ["serviceName"],
    },

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