Skip to main content
Glama
mcgiverdev

MCP API Server

by mcgiverdev

crear-usuario

Create a new user by providing first name, last name, and national ID number for user management operations.

Instructions

Crea un nuevo usuario con nombre, apellido y DNI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nombreYes
apellidoYes
dniYes

Implementation Reference

  • Handler function that implements the core logic for the 'crear-usuario' tool, extracting parameters, calling the user service, and returning formatted success or error response.
    export async function createUserToolHandler(params: any) {
      const { nombre, apellido, dni } = params;
      
      try {
        // Utilizamos el servicio de usuarios
        const userData = await createUser(nombre, apellido, dni);
        
        // Devolvemos el resultado formateado para MCP
        return {
          content: [
            {
              type: "text" as const,
              text: `✅ Usuario creado correctamente:
    - Nombre: ${userData.nombre}
    - Apellido: ${userData.apellido}
    - DNI: ${userData.dni}
    - ID: ${userData.id}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `❌ Error al crear usuario: ${error.message}`
            }
          ]
        };
      }
    }
  • Input schema validation using Zod for the 'crear-usuario' tool parameters: nombre, apellido, dni.
    export const createUserInputSchema = {
      nombre: z.string().min(2, "El nombre debe tener al menos 2 caracteres"),
      apellido: z.string().min(2, "El apellido debe tener al menos 2 caracteres"),
      dni: z.string().min(8, "El DNI debe tener al menos 8 caracteres")
    };
  • src/main.ts:34-41 (registration)
    Registration of the 'crear-usuario' tool in the MCP server, linking the name, description, input schema, and handler.
    server.registerTool(
      "crear-usuario",
      {
        description: "Crea un nuevo usuario con nombre, apellido y DNI",
        inputSchema: createUserInputSchema
      },
      createUserToolHandler
    );
  • Supporting service function createUser that performs validation, generates ID, creates user object, and stores in mock database.
    export async function createUser(nombre: string, apellido: string, dni: string): Promise<User> {
      // Validar que todos los campos estén presentes
      if (!nombre) throw new Error('El campo nombre es obligatorio');
      if (!apellido) throw new Error('El campo apellido es obligatorio');
      if (!dni) throw new Error('El campo DNI es obligatorio');
      
      // En un caso real, aquí validaríamos también el formato del DNI
      
      // Crear un nuevo usuario
      const newUser: User = {
        id: generateId(),
        nombre,
        apellido,
        dni,
        createdAt: new Date()
      };
      
      // Guardar el usuario (en un caso real, esto sería en una base de datos)
      users.push(newUser);
      
      return newUser;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Crea' implies a write operation, it doesn't specify permissions needed, whether the DNI must be unique, what happens on duplicate entries, or what the response contains. This leaves significant gaps for a mutation tool.

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 directly states the tool's purpose and parameters without any unnecessary words. It's appropriately sized and front-loaded with the core action.

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

Completeness2/5

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

For a mutation tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't address behavioral aspects like error conditions, response format, or system constraints, leaving the agent with incomplete operational understanding.

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

Parameters4/5

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

The description adds meaningful context beyond the schema by explaining that these parameters define a new user's identity (nombre, apellido, DNI). With 0% schema description coverage, this compensates well by clarifying the purpose of each parameter, though it doesn't provide format details like DNI length requirements.

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 ('Crea un nuevo usuario') and specifies the required attributes (nombre, apellido, DNI), which distinguishes it from sibling tools like listar-usuarios or crear-empresa. However, it doesn't explicitly differentiate from all siblings beyond the obvious resource difference.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when not to use it, or refer to other tools like listar-usuarios for checking existing users before creation.

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

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