Skip to main content
Glama

get_device_jobs

Retrieve all jobs for a specific device in NinjaOne, including running, completed, and failed jobs, with optional filtering by job type.

Instructions

Get all jobs (running, completed, and failed) for a specific device.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYesNinjaOne device ID
job_typeNoFilter by job type (e.g., SCRIPT, PATCH_INSTALL, CONDITION_ACTION)

Implementation Reference

  • The handler function that executes the get_device_jobs tool logic. It constructs API parameters and calls the NinjaOne API endpoint `/device/${device_id}/jobs` to retrieve all jobs (running, completed, and failed) for a specific device, then returns the results as JSON.
    async ({ device_id, job_type }) => {
      const params: Record<string, string> = {};
      if (job_type) params.jobType = job_type;
    
      try {
        const results = await client.get(
          `/device/${device_id}/jobs`,
          params,
        );
        return toolResult(JSON.stringify(results, null, 2));
      } catch (error) {
        return toolResult(
          `Error fetching device jobs: ${error}`,
          true,
        );
      }
    },
  • Zod schema definition for the get_device_jobs tool input parameters. Defines 'device_id' as a required number (NinjaOne device ID) and 'job_type' as an optional string filter (e.g., SCRIPT, PATCH_INSTALL, CONDITION_ACTION).
    {
      device_id: z.number().describe("NinjaOne device ID"),
      job_type: z
        .string()
        .optional()
        .describe(
          "Filter by job type (e.g., SCRIPT, PATCH_INSTALL, CONDITION_ACTION)",
        ),
    },
  • Complete registration of the get_device_jobs tool with the MCP server using server.tool(). Includes the tool name, description, input schema, and handler function.
    server.tool(
      "get_device_jobs",
      "Get all jobs (running, completed, and failed) for a specific device.",
      {
        device_id: z.number().describe("NinjaOne device ID"),
        job_type: z
          .string()
          .optional()
          .describe(
            "Filter by job type (e.g., SCRIPT, PATCH_INSTALL, CONDITION_ACTION)",
          ),
      },
      async ({ device_id, job_type }) => {
        const params: Record<string, string> = {};
        if (job_type) params.jobType = job_type;
    
        try {
          const results = await client.get(
            `/device/${device_id}/jobs`,
            params,
          );
          return toolResult(JSON.stringify(results, null, 2));
        } catch (error) {
          return toolResult(
            `Error fetching device jobs: ${error}`,
            true,
          );
        }
      },
    );
  • The NinjaOneClient.get() method used by the handler to make HTTP GET requests to the NinjaOne API. This helper method handles authentication, request construction, and response parsing.
    async get(
      path: string,
      params?: Record<string, string>,
    ): Promise<unknown> {
      return this.request("GET", path, undefined, params);
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action but doesn't disclose behavioral traits like pagination, rate limits, authentication needs, error handling, or what 'all jobs' entails (e.g., time range, limit). For a read operation with no annotation coverage, this is a significant gap.

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?

Single sentence, zero waste, front-loaded with the core action. Every word earns its place without redundancy or fluff.

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

Completeness2/5

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

For a tool with no annotations and no output schema, the description is incomplete. It doesn't explain return values, error cases, or behavioral constraints, leaving gaps for an AI agent to understand how to invoke it correctly beyond basic parameters.

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 description coverage is 100%, so the schema fully documents both parameters. The description adds no additional meaning beyond implying filtering by job status, which is already covered by the schema's job_type parameter. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb 'Get' and resource 'jobs for a specific device', specifying scope with 'all jobs (running, completed, and failed)'. It distinguishes from siblings like 'list_running_jobs' by covering all job statuses, but doesn't explicitly contrast with other job-related tools.

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 on when to use this tool versus alternatives like 'list_running_jobs' or 'get_device_activities'. The description implies usage for device-specific job retrieval but lacks explicit when/when-not instructions or prerequisite context.

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/fredriksknese/mcp-ninjaone'

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