Skip to main content
Glama
Kong

Kong Konnect MCP Server

Official
by Kong

list_routes

Retrieve and display all configured routes for a specific Kong Konnect control plane, including protocol, method, host, and path details for traffic management.

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)
sizeNoNumber of routes to return
offsetNoOffset token for pagination (from previous response)

Implementation Reference

  • The handler function that executes the list_routes tool logic: fetches routes from the Kong API and transforms the response into a standardized format.
    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;
      }
    }
  • Zod schema defining input parameters for the list_routes tool: 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)"),
    });
  • 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"
    },
  • src/index.ts:83-89 (registration)
    Dispatch handler in the MCP server 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
      );

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