Skip to main content
Glama

listar-usuarios

Retrieve all registered users in the system using a tool from the MCP API Server, designed for efficient user management and scalable TypeScript-based operations.

Instructions

Lista todos los usuarios registrados en el sistema

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function listUsersToolHandler that implements the core logic: fetches users from service, formats them into a readable list, handles empty case, and returns MCP-formatted text response.
    export async function listUsersToolHandler() { // Obtener la lista de usuarios const users = await getUsers(); // Formateamos la lista de usuarios para mostrarla let usersList = users.map(user => `- ID: ${user.id}\n Nombre: ${user.nombre} ${user.apellido}\n DNI: ${user.dni}\n Creado: ${user.createdAt.toLocaleString()}` ).join('\n\n'); // Si no hay usuarios, mostrar un mensaje adecuado if (users.length === 0) { usersList = "No hay usuarios registrados en el sistema."; } else { usersList = `Se encontraron ${users.length} usuario(s):\n\n${usersList}`; } // Devolvemos el resultado formateado para MCP return { content: [ { type: "text" as const, text: usersList } ] }; }
  • Zod input schema for the tool (empty object since the tool takes no parameters).
    /** * Definición del esquema de entrada para la herramienta de listar usuarios * (No requiere parámetros de entrada) */ export const listUsersInputSchema = {};
  • src/main.ts:43-50 (registration)
    Registration of the 'listar-usuarios' tool in the MCP server, linking name, schema, description, and handler.
    server.registerTool( "listar-usuarios", { description: "Lista todos los usuarios registrados en el sistema", inputSchema: listUsersInputSchema }, listUsersToolHandler );
  • Supporting service function that returns the list of users from in-memory database simulation.
    export async function getUsers(): Promise<User[]> { return [...users]; }

Other Tools

Related 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/mcgiverdev/mcp-api-v1'

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