get_organization
Retrieve organization details from Zendesk API using a unique organization ID for efficient customer support management.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Organization ID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "Organization ID",
"type": "number"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/organizations.js:36-52 (handler)The main handler function for the 'get_organization' tool. It calls zendeskClient.getOrganization(id), formats the result as JSON text content, or returns an error response.handler: async ({ id }) => { try { const result = await zendeskClient.getOrganization(id); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error getting organization: ${error.message}` }], isError: true }; } } },
- src/tools/organizations.js:33-35 (schema)Input schema using Zod for validating the 'id' parameter as a number.schema: { id: z.number().describe("Organization ID") },
- src/tools/organizations.js:30-52 (registration)The tool definition object including name, description, schema, and handler, which is exported as part of organizationsTools and later registered in server.js.{ name: "get_organization", description: "Get a specific organization by ID", schema: { id: z.number().describe("Organization ID") }, handler: async ({ id }) => { try { const result = await zendeskClient.getOrganization(id); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error getting organization: ${error.message}` }], isError: true }; } } },
- src/server.js:48-52 (registration)Registration loop in the MCP server that registers the 'get_organization' tool (included via organizationsTools spread) by calling server.tool().allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:126-128 (helper)ZendeskClient helper method that makes the API request to fetch a specific organization by ID, called by the tool handler.async getOrganization(id) { return this.request("GET", `/organizations/${id}.json`); }