ninja_get_organization_locations
Retrieve all locations for an organization by providing its ID.
Instructions
Get all locations for an organization.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Organization ID |
Implementation Reference
- src/tools/organizations.ts:129-130 (handler)The handler function for ninja_get_organization_locations. It extracts the 'id' from args and makes a GET request to /organization/{id}/locations using the NinjaOneClient.
handler: async ({ id }, client: NinjaOneClient) => client.get(`/organization/${id}/locations`), - src/tools/organizations.ts:121-127 (schema)Input schema for ninja_get_organization_locations. Requires a single 'id' parameter (number) representing the Organization ID.
inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Organization ID' }, }, }, - src/tools/organizations.ts:117-131 (registration)The tool definition registration for ninja_get_organization_locations within the organizationTools array. It defines the tool name, description, input schema, and handler.
{ tool: { name: 'ninja_get_organization_locations', description: 'Get all locations for an organization.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Organization ID' }, }, }, }, handler: async ({ id }, client: NinjaOneClient) => client.get(`/organization/${id}/locations`), }, - src/tools/index.ts:13-24 (registration)The ALL_TOOLS array that aggregates all tool definitions including organizationTools (which contains ninja_get_organization_locations).
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:35-59 (registration)The MCP server's CallToolRequestSchema handler that looks up tool handlers by name from toolMap (built from ALL_TOOLS) and invokes them.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const handler = toolMap.get(name); if (!handler) { return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true, }; } try { const result = await handler( (args ?? {}) as Record<string, unknown>, ninjaClient, ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (err) { return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true, }; }