Skip to main content
Glama
Kong

Kong Konnect MCP Server

Official
by Kong

list_consumers

Retrieve and manage all consumers associated with a specific control plane in Kong Konnect, with pagination support for handling large datasets.

Instructions

List all consumers associated with a control plane.

INPUT:

  • controlPlaneId: String - ID of the control plane

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

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

OUTPUT:

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

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

    • consumerId: String - Unique identifier for the consumer

    • username: String - Username for this consumer

    • customId: String - Custom identifier for this consumer

    • tags: Array - Tags associated with the consumer

    • enabled: Boolean - Whether the consumer is enabled

    • metadata: Object - Creation and update timestamps

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

Input Schema

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

Implementation Reference

  • Core handler function that executes the list_consumers tool logic: calls the Kong API and transforms the raw response into a structured output with metadata, formatted consumers list, and related tools suggestions.
    export async function listConsumers(
      api: KongApi,
      controlPlaneId: string,
      size = 100,
      offset?: string
    ) {
      try {
        const result = await api.listConsumers(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
          },
          consumers: result.data.map((consumer: any) => ({
            consumerId: consumer.id,
            username: consumer.username,
            customId: consumer.custom_id,
            tags: consumer.tags,
            enabled: consumer.enabled,
            metadata: {
              createdAt: consumer.created_at,
              updatedAt: consumer.updated_at
            }
          })),
          relatedTools: [
            "Use get-consumer-requests to analyze traffic for a specific consumer",
            "Use list-plugins to see plugins configured for these consumers",
            "Use query-api-requests to identify consumers with high error rates"
          ]
        };
      } catch (error) {
        throw error;
      }
    }
  • src/tools.ts:49-55 (registration)
    Tool specification registration in the tools() array, defining the method name, name, description prompt, parameters schema, and category for the list_consumers tool.
    {
      method: "list_consumers",
      name: "List Consumers",
      description: prompts.listConsumersPrompt(),
      parameters: parameters.listConsumersParameters(),
      category: "configuration"
    },
  • Zod schema defining the input parameters and validation for the list_consumers tool, including controlPlaneId, size, and optional offset.
    export const listConsumersParameters = () => 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 consumers to return"),
      offset: z.string()
        .optional()
        .describe("Offset token for pagination (from previous response)"),
    });
  • MCP server tool handler dispatch case that routes list_consumers tool invocations to the configuration.listConsumers handler.
    case "list_consumers":
      result = await configuration.listConsumers(
        this.api,
        args.controlPlaneId,
        args.size,
        args.offset
      );
  • Low-level API helper that constructs and executes the HTTP request to Kong's consumers list endpoint.
    async listConsumers(controlPlaneId: string, size = 100, offset?: string): Promise<any> {
      let endpoint = `/control-planes/${controlPlaneId}/core-entities/consumers?size=${size}`;
      
      if (offset) {
        endpoint += `&offset=${offset}`;
      }
    
      return this.kongRequest<any>(endpoint);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only partially discloses behavior. It mentions pagination (offset parameter and nextOffset in output) but doesn't address rate limits, authentication requirements, error conditions, or whether this is a read-only operation. For a list operation with no annotations, more behavioral context would be expected.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear INPUT and OUTPUT sections, though the OUTPUT section is quite detailed (listing all consumer fields). Every sentence serves a purpose, but the output details could potentially be moved to a proper output schema. The structure helps with readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a list operation with 3 parameters and no output schema, the description provides adequate coverage of inputs and outputs. However, with no annotations and sibling tools present, more context about when to use this tool versus alternatives would improve completeness. The inclusion of 'relatedTools' in the output is a helpful contextual element.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all parameters. The description adds minimal value beyond restating parameter names and types from the schema. The baseline score of 3 is appropriate since the schema does the heavy lifting, though the description doesn't add meaningful semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List all consumers associated with a control plane' - a specific verb ('List') with a specific resource ('consumers') and scope ('associated with a control plane'). This distinguishes it from siblings like 'list_control_planes' (different resource) and 'get_consumer_requests' (different action on same resource).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the parameter documentation (controlPlaneId must be obtained from list-control-planes tool), but doesn't explicitly state when to use this tool versus alternatives like 'get_consumer_requests' or 'check_control_plane_group_membership'. There's no guidance about prerequisites beyond the implied dependency on list-control-planes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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