get_user
Retrieve user details from Zendesk using their ID. Supports integration with Zendesk API MCP Server for managing Support, Talk, Chat, and Guide data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "User ID",
"type": "number"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/users.js:37-51 (handler)The main handler function for the 'get_user' MCP tool, which calls the Zendesk client's getUser method and formats the response as text content or an error.handler: async ({ id }) => { try { const result = await zendeskClient.getUser(id); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error getting user: ${error.message}` }], isError: true }; }
- src/tools/users.js:34-36 (schema)Input schema for the 'get_user' tool using Zod, requiring a numeric user ID.schema: { id: z.number().describe("User ID") },
- src/tools/users.js:31-52 (registration)Tool definition and registration within the usersTools array exported from users.js, which is later imported and registered in server.js.{ name: "get_user", description: "Get a specific user by ID", schema: { id: z.number().describe("User ID") }, handler: async ({ id }) => { try { const result = await zendeskClient.getUser(id); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error getting user: ${error.message}` }], isError: true }; } }
- src/server.js:48-52 (registration)Top-level registration loop in server.js where all tools, including get_user from usersTools, are registered to the MCP server.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:105-106 (helper)Helper method in ZendeskClient that performs the actual API request to fetch a user by ID.async getUser(id) { return this.request("GET", `/users/${id}.json`);