get_user
Retrieve user profile information from WebSim's public API by providing a username to access details and manage user data.
Instructions
Get details for a specific WebSim user
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | Yes | Username |
Input Schema (JSON Schema)
{
"properties": {
"user": {
"description": "Username",
"type": "string"
}
},
"required": [
"user"
],
"type": "object"
}
Implementation Reference
- server.js:487-500 (handler)The handler function for the 'get_user' MCP tool. It validates the input using UserParamsSchema, fetches the user data using apiClient.getUser(user), and returns a structured response containing the JSON-formatted user data.handler: async (args) => { const { user } = UserParamsSchema.parse(args); const result = await apiClient.getUser(user); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved user ${user}` }, null, 2) }] }; }
- server.js:477-486 (schema)Input schema definition for the 'get_user' tool, specifying the required 'user' parameter as a string.inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" } }, required: ["user"] },
- server.js:37-39 (schema)Zod validation schema used by the 'get_user' handler to parse and validate the input argument 'user'.const UserParamsSchema = z.object({ user: z.string().describe('Username') });
- server.js:137-139 (helper)Helper method in WebSimAPIClient that performs the HTTP request to fetch user details from the WebSim API endpoint.async getUser(user) { return this.makeRequest(`/api/v1/users/${user}`); }
- server.js:474-501 (registration)Registration of the 'get_user' tool in the tools array, including name, description, input schema, and handler. This array is used by the MCP server request handlers for tool listing and execution.{ name: "get_user", description: "Get details for a specific WebSim user", inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" } }, required: ["user"] }, handler: async (args) => { const { user } = UserParamsSchema.parse(args); const result = await apiClient.getUser(user); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved user ${user}` }, null, 2) }] }; } },