Skip to main content
Glama

ninja_get_device_active_jobs

Retrieve all active jobs currently running on a specific device. Use this to monitor job status and activity in real-time.

Instructions

Get currently running jobs on a device.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDevice ID

Implementation Reference

  • The full tool definition and handler for ninja_get_device_active_jobs. The handler makes a GET request to /device/{id}/jobs via the NinjaOneClient.
    {
      tool: {
        name: 'ninja_get_device_active_jobs',
        description: 'Get currently running jobs on a device.',
        inputSchema: {
          type: 'object',
          required: ['id'],
          properties: {
            id: { type: 'number', description: 'Device ID' },
          },
        },
      },
      handler: async ({ id }, client: NinjaOneClient) => client.get(`/device/${id}/jobs`),
    },
  • Input schema for the tool: requires a numeric 'id' parameter representing the Device ID.
    inputSchema: {
      type: 'object',
      required: ['id'],
      properties: {
        id: { type: 'number', description: 'Device ID' },
      },
    },
  • deviceTools array (which includes ninja_get_device_active_jobs) is spread into the ALL_TOOLS collection for registration.
    export const ALL_TOOLS = [
      ...deviceTools,
      ...organizationTools,
      ...alertTools,
      ...activityTools,
      ...ticketingTools,
      ...queryTools,
      ...policyTools,
      ...userTools,
      ...backupTools,
      ...systemTools,
    ];
  • src/index.ts:35-59 (registration)
    The MCP server's CallTool handler: looks up the tool by name from toolMap (built from ALL_TOOLS) and invokes its handler.
    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 ToolDef interface that defines the shape of each tool definition, including the handler signature.
    import { Tool } from '@modelcontextprotocol/sdk/types.js';
    import { NinjaOneClient } from '../client.js';
    
    export interface ToolDef {
      tool: Tool;
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      handler: (args: any, client: NinjaOneClient) => Promise<unknown>;
    }
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits such as read-only nature, rate limits, or what constitutes 'active' jobs. It carries the full burden but only says 'Get currently running jobs', which is minimal.

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

Conciseness3/5

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

One sentence, no waste, but overly brief for a tool with no other documentation. It is concise but could benefit from additional context without sacrificing brevity.

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?

No output schema, and description fails to explain what the return value contains (e.g., list of job objects, properties). For a simple tool, basic completeness would include output format or typical fields.

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?

Parameter id has description 'Device ID' in schema (100% coverage). Description adds no extra meaning beyond the schema, so baseline score of 3 is appropriate.

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?

Description states 'Get currently running jobs on a device', clearly specifying the verb (get) and resource (currently running jobs on a device). It distinguishes from sibling tools like ninja_get_backup_jobs or ninja_get_integrity_check_jobs by focusing on active jobs, though not explicitly stating that.

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 other job-related tools (e.g., ninja_get_backup_jobs). The description does not specify prerequisites or alternatives, leaving the agent to infer usage.

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