list_services
Retrieve detailed information about all services associated with a specific control plane using the Kong Konnect MCP Server. Input includes control plane ID, pagination size, and optional offset for efficient data retrieval.
Instructions
List all services associated with a control plane.
INPUT:
controlPlaneId: String - ID of the control plane
size: Number - Number of services to return (1-1000, default: 100)
offset: String (optional) - Pagination offset token from previous response
OUTPUT:
metadata: Object - Contains controlPlaneId, size, offset, nextOffset, totalCount
services: Array - List of services with details for each including:
serviceId: String - Unique identifier for the service
name: String - Display name of the service
host: String - Target host for the service
port: Number - Target port for the service
protocol: String - Protocol used (http, https, grpc, etc.)
path: String - Path prefix for the service
retries: Number - Number of retries on failure
connectTimeout: Number - Connection timeout in milliseconds
writeTimeout: Number - Write timeout in milliseconds
readTimeout: Number - Read timeout in milliseconds
tags: Array - Tags associated with the service
enabled: Boolean - Whether the service is enabled
metadata: Object - Creation and update timestamps
relatedTools: Array - List of related tools for further analysis
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| controlPlaneId | Yes | Control Plane ID (obtainable from list-control-planes tool) | |
| offset | No | Offset token for pagination (from previous response) | |
| size | No | Number of services to return |
Implementation Reference
- src/operations/configuration.ts:6-54 (handler)The primary handler function for the list_services tool. Fetches services via API and transforms the response into a structured format with metadata, services list, and related tools suggestions.export async function listServices( api: KongApi, controlPlaneId: string, size = 100, offset?: string ) { try { const result = await api.listServices(controlPlaneId, size, offset); // Transform the response to have consistent field names return { metadata: { controlPlaneId: controlPlaneId, size: size, offset: offset || null, nextOffset: result.offset, totalCount: result.total }, services: result.data.map((service: any) => ({ serviceId: service.id, name: service.name, host: service.host, port: service.port, protocol: service.protocol, path: service.path, retries: service.retries, connectTimeout: service.connect_timeout, writeTimeout: service.write_timeout, readTimeout: service.read_timeout, tags: service.tags, clientCertificate: service.client_certificate, tlsVerify: service.tls_verify, tlsVerifyDepth: service.tls_verify_depth, caCertificates: service.ca_certificates, enabled: service.enabled, metadata: { createdAt: service.created_at, updatedAt: service.updated_at } })), relatedTools: [ "Use list-routes to find routes that point to these services", "Use list-plugins to see plugins configured for these services" ] }; } catch (error) { throw error; } }
- src/tools.ts:35-41 (registration)Tool registration entry defining the method name, name, description (from prompts), input parameters schema, and category.{ method: "list_services", name: "List Services", description: prompts.listServicesPrompt(), parameters: parameters.listServicesParameters(), category: "configuration" },
- src/parameters.ts:66-76 (schema)Zod schema defining input parameters for the list_services tool: controlPlaneId (required), size (default 100), offset (optional).export const listServicesParameters = () => z.object({ controlPlaneId: z.string() .describe("Control Plane ID (obtainable from list-control-planes tool)"), size: z.number().int() .min(1).max(1000) .default(100) .describe("Number of services to return"), offset: z.string() .optional() .describe("Offset token for pagination (from previous response)"), });
- src/index.ts:74-81 (handler)Dispatch handler in the main MCP server switch statement that routes list_services tool calls to the configuration.listServices function.case "list_services": result = await configuration.listServices( this.api, args.controlPlaneId, args.size, args.offset ); break;
- src/api.ts:152-160 (helper)API client method that makes the HTTP request to Kong's list services endpoint.async listServices(controlPlaneId: string, size = 100, offset?: string): Promise<any> { let endpoint = `/control-planes/${controlPlaneId}/core-entities/services?size=${size}`; if (offset) { endpoint += `&offset=${offset}`; } return this.kongRequest<any>(endpoint); }