get_organization_locations
Retrieve configured locations for a NinjaOne organization to manage device inventory and organization structure.
Instructions
Get the locations configured for a specific organization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization_id | Yes | NinjaOne organization ID |
Implementation Reference
- src/tools/organizations.ts:95-107 (handler)The handler function that executes the tool logic. It makes an API call to `/organization/${organization_id}/locations` and returns the results as JSON or an error message.
async ({ organization_id }) => { try { const results = await client.get( `/organization/${organization_id}/locations`, ); return toolResult(JSON.stringify(results, null, 2)); } catch (error) { return toolResult( `Error fetching organization locations: ${error}`, true, ); } }, - src/tools/organizations.ts:92-94 (schema)Input schema definition using Zod. Requires organization_id as a number parameter with a description.
{ organization_id: z.number().describe("NinjaOne organization ID"), }, - src/tools/organizations.ts:89-108 (registration)Complete tool registration with the MCP server. Registers the tool name, description, input schema, and handler function.
server.tool( "get_organization_locations", "Get the locations configured for a specific organization.", { organization_id: z.number().describe("NinjaOne organization ID"), }, async ({ organization_id }) => { try { const results = await client.get( `/organization/${organization_id}/locations`, ); return toolResult(JSON.stringify(results, null, 2)); } catch (error) { return toolResult( `Error fetching organization locations: ${error}`, true, ); } }, );