Skip to main content
Glama
yvanfreitas

MCP Test Server

by yvanfreitas

get_user

Retrieve user details by ID from the MCP Test Server's user management system. Provide the user ID to access specific user information.

Instructions

Get a specific user by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUser ID

Implementation Reference

  • The core handler function that retrieves a specific user by ID from the mock users data and returns success or error response.
    static getById(id) {
      const user = users.find(u => u.id === id);
      
      if (!user) {
        return {
          success: false,
          message: 'User not found'
        };
      }
    
      return {
        success: true,
        data: user
      };
    }
  • Input schema definition for the 'get_user' tool, specifying a required numeric 'id' parameter.
    {
      name: 'get_user',
      description: 'Get a specific user by ID',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'number',
            description: 'User ID'
          }
        },
        required: ['id']
      }
    },
  • mcp-server.js:56-57 (registration)
    Tool call dispatcher that maps 'get_user' requests to the UserService.getById handler.
    case 'get_user':
      return createMcpResponse(UserService.getById(args.id));
  • mcp-server.js:38-46 (registration)
    Registers the list tools handler which includes the 'get_user' schema from userToolSchemas.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          ...userToolSchemas,
          ...taskToolSchemas,
          searchToolSchema
        ]
      };
    });

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/yvanfreitas/MCP-test'

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