Skip to main content
Glama
small-tou

MCP Test Server

by small-tou

search_users

Search and filter users by keyword or role on the MCP Test Server to manage user data efficiently for testing and analysis purposes.

Instructions

搜索用户

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键词
roleNo按角色筛选

Implementation Reference

  • The asynchronous handler function for the 'search_users' tool. It filters the testData.users array based on the query string matching name or email, optionally filters by role, logs the search, and returns a formatted text response with results.
    }, async (args) => {
      const { query, role } = args;
      let results = testData.users.filter(user => 
        user.name.includes(query) || user.email.includes(query)
      );
      
      if (role) {
        results = results.filter(user => user.role === role);
      }
      
      testData.logs.push(`搜索用户: "${query}" ${role ? `(角色: ${role})` : ""}`);
      
      return {
        content: [{
          type: "text",
          text: `🔍 搜索结果 (${results.length}个):\n${JSON.stringify(results, null, 2)}`
        }]
      };
    });
  • Zod input schema for 'search_users' tool: required 'query' (string), optional 'role' (enum: 'admin' or 'user').
    query: z.string().describe("搜索关键词"),
    role: z.enum(["admin", "user"]).optional().describe("按角色筛选")
  • src/index.ts:121-142 (registration)
    Registration of the 'search_users' tool using McpServer.tool(), specifying name, description (Chinese: '搜索用户'), input schema, and inline handler function.
    server.tool("search_users", "搜索用户", {
      query: z.string().describe("搜索关键词"),
      role: z.enum(["admin", "user"]).optional().describe("按角色筛选")
    }, async (args) => {
      const { query, role } = args;
      let results = testData.users.filter(user => 
        user.name.includes(query) || user.email.includes(query)
      );
      
      if (role) {
        results = results.filter(user => user.role === role);
      }
      
      testData.logs.push(`搜索用户: "${query}" ${role ? `(角色: ${role})` : ""}`);
      
      return {
        content: [{
          type: "text",
          text: `🔍 搜索结果 (${results.length}个):\n${JSON.stringify(results, null, 2)}`
        }]
      };
    });
Behavior1/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 but provides none. It doesn't indicate whether this is a read-only operation, what permissions might be required, whether results are paginated or limited, what happens with empty queries, or how results are sorted. For a search tool with zero annotation coverage, this represents a complete lack of behavioral context.

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 extremely concise - just two Chinese characters. While this represents efficient communication, it's arguably under-specified rather than appropriately concise. However, given the scoring framework, it earns points for being front-loaded with the core purpose and having zero wasted words, though it lacks the structure of a more complete description.

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?

Given the tool's complexity (search operation with filtering), lack of annotations, and absence of an output schema, the description is insufficiently complete. It doesn't explain what the search returns, how results are formatted, whether there are limitations on search scope, or any error conditions. For a search tool that likely returns structured user data, this minimal description leaves critical gaps in understanding.

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 schema description coverage is 100%, with both parameters ('query' and 'role') having descriptions in the schema. The tool description adds no additional parameter information beyond what's already documented in the schema. According to the scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter info in the description.

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

Purpose2/5

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

The description '搜索用户' (Search users) states the general purpose but is vague and tautological - it essentially restates the tool name 'search_users' in Chinese. It doesn't specify what kind of search this performs (exact match, partial, fuzzy), what user attributes are searched, or how results are returned. While it indicates the verb (search) and resource (users), it lacks the specificity needed for clear agent understanding.

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?

There is no guidance on when to use this tool versus alternatives. The description doesn't mention any prerequisites, limitations, or comparison with sibling tools like 'add_user'. An agent wouldn't know if this is for finding existing users before adding new ones, or if there are specific scenarios where this search is appropriate versus other user-related operations.

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