list_services
Retrieve and display all services configured within a specified Kong Konnect control plane, including details like host, port, protocol, and status.
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) | |
| size | No | Number of services to return | |
| offset | No | Offset token for pagination (from previous response) |
Implementation Reference
- src/operations/configuration.ts:6-54 (handler)The main handler function that executes the list_services tool: calls the Kong API, transforms service data into a consistent format with metadata, and includes related tool 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/parameters.ts:66-76 (schema)Zod schema defining the 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/tools.ts:35-41 (registration)Tool definition object in the tools() array that provides the metadata (method, name, description, parameters schema, category) used for MCP tool registration.{ method: "list_services", name: "List Services", description: prompts.listServicesPrompt(), parameters: parameters.listServicesParameters(), category: "configuration" },
- src/index.ts:74-81 (registration)Dispatch logic in the MCP tool handler switch statement that routes 'list_services' calls to the configuration.listServices handler with the API instance and parsed arguments.case "list_services": result = await configuration.listServices( this.api, args.controlPlaneId, args.size, args.offset ); break;