Skip to main content
Glama

ninja_query_software

Query software inventory across managed devices with filters for name or device type. Supports pagination to retrieve results.

Instructions

Query software inventory across all managed devices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dfNoDevice filter expression
pageSizeNoMax results to return
cursorNoPagination cursor from previous response
nameNoFilter by software name (partial match)

Implementation Reference

  • The queryTool function on line 11 creates a ToolDef with a handler that calls NinjaOneClient.get(path, clean(args)). For 'ninja_query_software', the handler is an async closure that makes a GET request to '/queries/software' with cleaned query parameters (df, pageSize, cursor, name).
    function queryTool(
      name: string,
      description: string,
      path: string,
      extraProps: Record<string, unknown> = {},
    ): ToolDef {
      return {
        tool: {
          name,
          description,
          inputSchema: {
            type: 'object',
            properties: { ...basePaginationProps, ...extraProps },
          },
        },
        handler: async (args, client: NinjaOneClient) => client.get(path, clean(args)),
      };
  • The schema (inputSchema) for 'ninja_query_software' includes base pagination props (df, pageSize, cursor) plus an extra optional string parameter 'name' for filtering by software name. The schema is defined inline within the queryTool call on line 89-96.
    queryTool(
      'ninja_query_software',
      'Query software inventory across all managed devices.',
      '/queries/software',
      {
        name: { type: 'string', description: 'Filter by software name (partial match)' },
      },
    ),
  • The tool is registered as part of the ALL_TOOLS array in src/tools/index.ts by spreading queryTools (which includes 'ninja_query_software') into the list. The registration occurs at src/tools/index.ts:13-24.
    export const ALL_TOOLS = [
      ...deviceTools,
      ...organizationTools,
      ...alertTools,
      ...activityTools,
      ...ticketingTools,
      ...queryTools,
      ...policyTools,
      ...userTools,
      ...backupTools,
      ...systemTools,
    ];
  • src/index.ts:23-60 (registration)
    In src/index.ts, ALL_TOOLS is loaded and a toolMap is built by mapping each ToolDef's tool.name to its handler. On ListToolsRequestSchema, all tool definitions are returned. On CallToolRequestSchema, the handler is looked up by name and invoked with the NinjaOneClient. Lines 24, 31-33, 35-44 show this runtime registration and dispatch.
    const ninjaClient = new NinjaOneClient(NINJA_BASE_URL, NINJA_CLIENT_ID, NINJA_CLIENT_SECRET);
    const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler]));
    
    const server = new Server(
      { name: 'ninjaone-mcp', version: '1.0.0' },
      { capabilities: { tools: {} } },
    );
    
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: ALL_TOOLS.map((def) => def.tool),
    }));
    
    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,
        };
      }
    });
  • The 'clean' utility function is used by the handler to strip null/empty values from the arguments object before passing them as query parameters to the API call.
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    export function clean(args: Record<string, any>): Record<string, unknown> {
      return Object.fromEntries(
        Object.entries(args).filter(([, v]) => v != null && v !== ''),
      );
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description implies a read-only query, but with no annotations, it should cover potential performance impacts, authentication needs, or that it spans multiple devices. The minimal statement provides basic purpose but not deeper behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that efficiently conveys the tool's purpose without extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is adequate for a simple query tool but lacks information about the output format. Since there is no output schema, the description should hint at what the response contains (e.g., list of software with versions).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear parameter descriptions (device filter, page size, cursor, name). The description adds no extra meaning beyond the schema, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Query software inventory across all managed devices' clearly states the verb (query) and resource (software inventory). It distinguishes from sibling query tools that target other resources like antivirus, disks, etc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'ninja_get_device_software' or 'ninja_query_installed_software_patches'. The description lacks contextual cues for choosing this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Allied-Business-Solutions/ninjaone-mcp'

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