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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID |
Implementation Reference
- src/domains/users.js:18-32 (handler)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 }; }
- src/domains/users.js:86-99 (schema)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';