Skip to main content
Glama

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
NameRequiredDescriptionDefault
organization_idYesNinjaOne organization ID

Implementation Reference

  • 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,
        );
      }
    },
  • Input schema definition using Zod. Requires organization_id as a number parameter with a description.
    {
      organization_id: z.number().describe("NinjaOne organization ID"),
    },
  • 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,
          );
        }
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fredriksknese/mcp-ninjaone'

If you have feedback or need assistance with the MCP directory API, please join our Discord server