Skip to main content
Glama
yvanfreitas

MCP Test Server

by yvanfreitas

get_user

Retrieve user details by specifying a unique ID using the MCP Test Server's tool. Access essential information for user management and data interaction tasks.

Instructions

Get a specific user by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUser ID

Implementation Reference

  • The core handler function that retrieves a user by ID from the mock data store. This is invoked directly in the tool dispatch.
    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 }; }
  • JSON schema defining the input parameters for the get_user tool, specifying a required numeric 'id'.
    { 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)
    Registers the tool handler in the MCP call tool request switch statement, mapping 'get_user' to UserService.getById.
    case 'get_user': return createMcpResponse(UserService.getById(args.id));
  • mcp-server.js:38-46 (registration)
    Registers the tool schemas (including get_user) in the MCP list tools request handler by spreading userToolSchemas.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ] }; });
  • mcp-server.js:13-13 (registration)
    Imports the UserService handler and userToolSchemas necessary for get_user tool.
    import { UserService, userToolSchemas } from './src/domains/users.js';

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

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