get_organization
Retrieve organization details including contact information, assigned tags, and policy configurations using the NinjaOne organization ID.
Instructions
Get detailed information about a specific organization by its ID, including contact info, tags, and policy assignments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization_id | Yes | NinjaOne organization ID |
Implementation Reference
- src/tools/organizations.ts:47-64 (handler)Handler for 'get_organization' tool. Makes API call to /organization/{id} endpoint and returns JSON result or error.
server.tool( "get_organization", "Get detailed information about a specific organization by its ID, including contact info, tags, and policy assignments.", { organization_id: z.number().describe("NinjaOne organization ID"), }, async ({ organization_id }) => { try { const result = await client.get(`/organization/${organization_id}`); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult( `Error fetching organization: ${error}`, true, ); } }, ); - src/tools/organizations.ts:50-52 (schema)Zod schema defining the input parameter for get_organization tool - organization_id as a required number.
{ organization_id: z.number().describe("NinjaOne organization ID"), }, - src/index.ts:37-37 (registration)Registration of organization tools including get_organization in the main server setup.
registerOrganizationTools(server, client); - src/tools/organizations.ts:5-7 (helper)Helper function to format tool responses in MCP format with content array and optional error flag.
function toolResult(text: string, isError = false) { return { content: [{ type: "text" as const, text }], isError }; }