Skip to main content
Glama
nacos-group

Nacos MCP Server

Official
by nacos-group

list_service_instances

Retrieve a list of service instances by specifying namespace, group, service name, and optional cluster details for efficient service discovery and management.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clusterNameNoThe cluster name of instances in service, optional and default is null means match all cluster. If need match multiple cluster, use `,` to split like `cluster1,cluster2`
groupNameNoThe groupName pattern of service, default is `DEFAULT_GROUP` if missing
namespaceIdNoThe namespaceId of service, default is `public` if missing
serviceNameYesThe serviceName pattern of service, required.

Implementation Reference

  • Executes the 'list_service_instances' tool by retrieving the Nacos API URL and making an HTTP GET request with provided arguments via NacosServer.get.
    case nacos_tools.NacosToolNames.LIST_INSTANCES: url = nacos_tools.NacosListInstances().url result = nacos.get(name, url, arguments) return [types.TextContent(type="text", text=result)]
  • Defines the tool class NacosListInstances with name 'list_service_instances', input schema for namespaceId, groupName, serviceName, clusterName, description, and Nacos API endpoint.
    class NacosListInstances(NacosTool): def __init__(self): super().__init__( name=NacosToolNames.LIST_INSTANCES, description="This interface retrieves the list of instances for a specified service.", inputSchema={ "type": "object", "properties": { "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."}, "clusterName": {"type": "string", "description": "The cluster name of instances in service, optional and default is null means match all cluster. If need match multiple cluster, use `,` to split like `cluster1,cluster2`"}, }, "required": ["serviceName"], }, url="/nacos/v3/admin/ns/instance/list" )
  • Registers the NacosListInstances tool (for 'list_service_instances') in the MCP server's list of available 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(), ]
  • Defines the enum constant NacosToolNames.LIST_INSTANCES = 'list_service_instances' used for tool identification in registration and handler.
    LIST_INSTANCES = "list_service_instances",

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