Skip to main content
Glama
Kong

Kong Konnect MCP Server

Official
by Kong

list_routes

Retrieve and manage all routes linked to a specific control plane, including details like protocols, methods, hosts, and paths. Supports pagination for efficient route inspection and configuration.

Instructions

List all routes associated with a control plane.

INPUT:

  • controlPlaneId: String - ID of the control plane

  • size: Number - Number of routes to return (1-1000, default: 100)

  • offset: String (optional) - Pagination offset token from previous response

OUTPUT:

  • metadata: Object - Contains controlPlaneId, size, offset, nextOffset, totalCount

  • routes: Array - List of routes with details for each including:

    • routeId: String - Unique identifier for the route

    • name: String - Display name of the route

    • protocols: Array - Protocols this route accepts (http, https, grpc, etc.)

    • methods: Array - HTTP methods this route accepts

    • hosts: Array - Hostnames this route matches

    • paths: Array - URL paths this route matches

    • stripPath: Boolean - Whether to strip the matched path prefix

    • preserveHost: Boolean - Whether to preserve the host header

    • serviceId: String - ID of the service this route forwards to

    • enabled: Boolean - Whether the route is enabled

    • metadata: Object - Creation and update timestamps

  • relatedTools: Array - List of related tools for further analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
controlPlaneIdYesControl Plane ID (obtainable from list-control-planes tool)
offsetNoOffset token for pagination (from previous response)
sizeNoNumber of routes to return

Implementation Reference

  • Main handler function that lists routes for a control plane, calls the API, transforms the response with metadata, detailed route objects, and suggests related tools.
    export async function listRoutes( api: KongApi, controlPlaneId: string, size = 100, offset?: string ) { try { const result = await api.listRoutes(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 }, routes: result.data.map((route: any) => ({ routeId: route.id, name: route.name, protocols: route.protocols, methods: route.methods, hosts: route.hosts, paths: route.paths, https_redirect_status_code: route.https_redirect_status_code, regex_priority: route.regex_priority, stripPath: route.strip_path, preserveHost: route.preserve_host, requestBuffering: route.request_buffering, responseBuffering: route.response_buffering, tags: route.tags, serviceId: route.service?.id, enabled: route.enabled, metadata: { createdAt: route.created_at, updatedAt: route.updated_at } })), relatedTools: [ "Use query-api-requests with specific routeIds to analyze traffic", "Use list-services to find details about the services these routes connect to", "Use list-plugins to see plugins configured for these routes" ] }; } catch (error) { throw error; } }
  • src/tools.ts:42-48 (registration)
    Registration of the list_routes tool in the tools array, specifying method, name, description, parameters schema, and category.
    { method: "list_routes", name: "List Routes", description: prompts.listRoutesPrompt(), parameters: parameters.listRoutesParameters(), category: "configuration" },
  • Zod input schema definition for the list_routes tool parameters: controlPlaneId (required), size (optional, default 100), offset (optional).
    export const listRoutesParameters = () => 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 routes to return"), offset: z.string() .optional() .describe("Offset token for pagination (from previous response)"), });
  • Dispatch handler in the main tool switch statement that routes list_routes calls to the configuration.listRoutes function.
    case "list_routes": result = await configuration.listRoutes( this.api, args.controlPlaneId, args.size, args.offset ); break;
  • Helper function providing the detailed prompt/description text for the list_routes tool used in registration.
    export const listRoutesPrompt = () => ` List all routes associated with a control plane. INPUT: - controlPlaneId: String - ID of the control plane - size: Number - Number of routes to return (1-1000, default: 100) - offset: String (optional) - Pagination offset token from previous response OUTPUT: - metadata: Object - Contains controlPlaneId, size, offset, nextOffset, totalCount - routes: Array - List of routes with details for each including: - routeId: String - Unique identifier for the route - name: String - Display name of the route - protocols: Array - Protocols this route accepts (http, https, grpc, etc.) - methods: Array - HTTP methods this route accepts - hosts: Array - Hostnames this route matches - paths: Array - URL paths this route matches - stripPath: Boolean - Whether to strip the matched path prefix - preserveHost: Boolean - Whether to preserve the host header - serviceId: String - ID of the service this route forwards to - enabled: Boolean - Whether the route is enabled - metadata: Object - Creation and update timestamps - relatedTools: Array - List of related tools for further analysis `;

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/Kong/mcp-konnect'

If you have feedback or need assistance with the MCP directory API, please join our Discord server