Skip to main content
Glama
small-tou

MCP Test Server

by small-tou

add_user

Create and manage new users on the MCP Test Server by specifying name, email, and role. Simplify user administration with this tool.

Instructions

添加新用户

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes邮箱地址
nameYes用户姓名
roleNo用户角色user

Implementation Reference

  • The handler function for the 'add_user' tool. It destructures the input args, generates a new user ID, creates the new user object, appends it to testData.users, logs the action to testData.logs, and returns a success message with the new user details.
    }, async (args) => {
      const { name, email, role = "user" } = args;
      const newUser = {
        id: Math.max(...testData.users.map(u => u.id)) + 1,
        name,
        email,
        role
      };
      
      testData.users.push(newUser);
      testData.logs.push(`添加用户: ${name} (${email})`);
      
      return {
        content: [{
          type: "text",
          text: `✅ 成功添加用户: ${JSON.stringify(newUser, null, 2)}`
        }]
      };
    });
  • Zod input schema for the 'add_user' tool defining required string fields 'name' and 'email', and optional 'role' enum with default 'user'.
    name: z.string().describe("用户姓名"),
    email: z.string().describe("邮箱地址"),
    role: z.enum(["admin", "user"]).optional().default("user").describe("用户角色")
  • src/index.ts:96-118 (registration)
    Registration of the 'add_user' tool on the MCP server, including name, description in Chinese, input schema, and inline handler function.
    server.tool("add_user", "添加新用户", {
      name: z.string().describe("用户姓名"),
      email: z.string().describe("邮箱地址"),
      role: z.enum(["admin", "user"]).optional().default("user").describe("用户角色")
    }, async (args) => {
      const { name, email, role = "user" } = args;
      const newUser = {
        id: Math.max(...testData.users.map(u => u.id)) + 1,
        name,
        email,
        role
      };
      
      testData.users.push(newUser);
      testData.logs.push(`添加用户: ${name} (${email})`);
      
      return {
        content: [{
          type: "text",
          text: `✅ 成功添加用户: ${JSON.stringify(newUser, null, 2)}`
        }]
      };
    });
  • Shared testData object that stores the users array (modified by add_user) and logs array (updated by handler). Used across tools and resources.
    const testData = {
      users: [
        { id: 1, name: "张三", email: "zhangsan@example.com", role: "admin" },
        { id: 2, name: "李四", email: "lisi@example.com", role: "user" },
        { id: 3, name: "王五", email: "wangwu@example.com", role: "user" }
      ],
      todos: [
        { id: 1, title: "完成MCP测试项目", completed: false, userId: 1 },
        { id: 2, title: "学习TypeScript", completed: true, userId: 2 },
        { id: 3, title: "测试MCP功能", completed: false, userId: 1 }
      ],
      logs: [] as string[]
    };
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. '添加新用户' implies a write/mutation operation, but it doesn't specify permissions required, whether the operation is idempotent, what happens on duplicate emails, or error conditions. This leaves significant gaps for a tool that creates users.

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 extremely concise - a single phrase that directly states the tool's purpose without any unnecessary words. It's front-loaded and wastes no space, though this conciseness comes at the cost of completeness.

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 user creation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, what permissions are needed, how conflicts are handled, or other important behavioral aspects that an agent needs to use this tool effectively.

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%, with all parameters (email, name, role) well-documented in the schema itself. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline for adequate coverage without adding 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 '添加新用户' (Add new user) clearly states the verb ('add') and resource ('user'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search_users' or 'create_todo', which would require more specific context about what distinguishes user creation from other operations.

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 like 'search_users' or other sibling tools. There's no mention of prerequisites, typical use cases, or exclusions, leaving the agent to infer usage from the tool name alone.

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

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/small-tou/mcp-test'

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