Skip to main content
Glama
correaito
by correaito

Listar Usuários

list-users

Retrieve and manage all registered Clerk users with pagination controls. Supports ordering by creation or update date for organized user administration.

Instructions

Lista todos os usuários cadastrados no Clerk com paginação

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
orderByNocreated_at

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
errorNo
successYes

Implementation Reference

  • The core execution logic for the 'list-users' tool. Calls Clerk's getUserList API, processes and maps user data, handles pagination and errors.
    export async function listUsers(params: {
      limit?: number;
      offset?: number;
      orderBy?: 'created_at' | 'updated_at';
    }) {
      try {
        const { limit = 10, offset = 0, orderBy = 'created_at' } = params;
    
        const response = await clerk.users.getUserList({
          limit,
          offset,
          orderBy: orderBy === 'created_at' ? '-created_at' : '-updated_at'
        });
    
        const users = response.data.map(user => ({
          id: user.id,
          email: user.emailAddresses[0]?.emailAddress || null,
          firstName: user.firstName,
          lastName: user.lastName,
          username: user.username,
          createdAt: user.createdAt,
          updatedAt: user.updatedAt,
          locked: user.locked,
          banned: user.banned
        }));
    
        return {
          success: true,
          data: {
            users,
            total: response.totalCount,
            limit,
            offset
          }
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message || 'Erro ao listar usuários'
        };
      }
    }
  • Input schema validation for the 'list-users' tool using Zod, defining optional pagination and ordering parameters.
    export const listUsersSchema = {
      limit: z.number().min(1).max(100).optional().default(10),
      offset: z.number().min(0).optional().default(0),
      orderBy: z.enum(['created_at', 'updated_at']).optional().default('created_at')
    };
  • src/server.ts:28-61 (registration)
    Registration of the 'list-users' tool in the HTTP MCP server, including title, description, input/output schemas, and thin handler wrapper that calls the core listUsers function.
      'list-users',
      {
        title: 'Listar Usuários',
        description: 'Lista todos os usuários cadastrados no Clerk com paginação',
        inputSchema: listUsersSchema,
        outputSchema: {
          success: z.boolean(),
          data: z.object({
            users: z.array(z.object({
              id: z.string(),
              email: z.string().nullable(),
              firstName: z.string().nullable(),
              lastName: z.string().nullable(),
              username: z.string().nullable(),
              createdAt: z.number(),
              updatedAt: z.number(),
              locked: z.boolean(),
              banned: z.boolean()
            })),
            total: z.number(),
            limit: z.number(),
            offset: z.number()
          }).optional(),
          error: z.string().optional()
        }
      },
      async (params) => {
        const result = await listUsers(params);
        return {
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          structuredContent: result
        };
      }
    );
  • Registration of the 'list-users' tool in the STDIO MCP server, identical to the HTTP version.
    server.registerTool(
      'list-users',
      {
        title: 'Listar Usuários',
        description: 'Lista todos os usuários cadastrados no Clerk com paginação',
        inputSchema: listUsersSchema,
        outputSchema: {
          success: z.boolean(),
          data: z.object({
            users: z.array(z.object({
              id: z.string(),
              email: z.string().nullable(),
              firstName: z.string().nullable(),
              lastName: z.string().nullable(),
              username: z.string().nullable(),
              createdAt: z.number(),
              updatedAt: z.number(),
              locked: z.boolean(),
              banned: z.boolean()
            })),
            total: z.number(),
            limit: z.number(),
            offset: z.number()
          }).optional(),
          error: z.string().optional()
        }
      },
      async (params) => {
        const result = await listUsers(params);
        return {
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          structuredContent: result
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions pagination, which is useful, but fails to address critical aspects like authentication requirements, rate limits, error handling, or the structure of returned data. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose ('Lista todos os usuários') and adds essential context ('cadastrados no Clerk com paginação'). There is no wasted verbiage, making it highly concise and well-structured.

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?

Given the tool's moderate complexity (3 parameters, pagination), no annotations, and the presence of an output schema (which handles return values), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and parameter semantics, leaving room for improvement in completeness.

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?

The description adds no parameter-specific information beyond implying pagination (related to limit and offset). With 0% schema description coverage and 3 parameters, the schema documents constraints (e.g., min/max, enums, defaults), but the description doesn't compensate by explaining parameter meanings or usage. Baseline 3 is appropriate as the schema handles documentation, but the description adds minimal value.

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

Purpose4/5

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

The description clearly states the action ('Lista') and resource ('usuários cadastrados no Clerk'), specifying pagination as a key feature. It distinguishes from siblings like delete-user, lock-user, and unlock-user by focusing on retrieval rather than modification, though it doesn't explicitly name alternatives.

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 for retrieving all users with pagination, but provides no explicit guidance on when to use this tool versus alternatives or any prerequisites. The context suggests it's for read operations, but lacks clear exclusions or comparisons with sibling tools.

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/correaito/mcp_clerk'

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