get_user
Retrieve user details from Zendesk by providing a user ID to access customer information and support data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID |
Implementation Reference
- src/tools/users.js:37-51 (handler)Handler function that implements the core logic of the 'get_user' tool by calling the Zendesk client to fetch user data by ID and handling the response or errors.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)Zod input schema defining the 'id' parameter as a required number for the 'get_user' tool.schema: { id: z.number().describe("User ID") },
- src/server.js:48-52 (registration)Registers the 'get_user' tool (along with others) with the MCP server using server.tool().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 API GET request to fetch a user by ID, used by the tool handler.async getUser(id) { return this.request("GET", `/users/${id}.json`);