Skip to main content
Glama

ninja_get_device_windows_services

Retrieve Windows services and their current status for a specified device. Filter by service name or state to narrow results.

Instructions

Get Windows services and their current status for a device.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesDevice ID
nameNoFilter by service name
stateNoFilter by state (RUNNING, STOPPED, PAUSED, etc.)

Implementation Reference

  • Handler function that extracts 'id' from args and passes remaining params (name, state) as query parameters to GET /device/{id}/windows-services, using the clean() helper to remove empty/null values.
      handler: async ({ id, ...params }, client: NinjaOneClient) =>
        client.get(`/device/${id}/windows-services`, clean(params)),
    },
  • Tool definition and input schema for 'ninja_get_device_windows_services'. Requires 'id' (number) and accepts optional 'name' (string) and 'state' (string) filters.
    tool: {
      name: 'ninja_get_device_windows_services',
      description: 'Get Windows services and their current status for a device.',
      inputSchema: {
        type: 'object',
        required: ['id'],
        properties: {
          id: { type: 'number', description: 'Device ID' },
          name: { type: 'string', description: 'Filter by service name' },
          state: { type: 'string', description: 'Filter by state (RUNNING, STOPPED, PAUSED, etc.)' },
        },
      },
  • The tool is registered in the ALL_TOOLS array by spreading deviceTools (which includes ninja_get_device_windows_services). This array is used in src/index.ts to build the toolMap and list tools.
    export const ALL_TOOLS = [
      ...deviceTools,
      ...organizationTools,
      ...alertTools,
      ...activityTools,
      ...ticketingTools,
      ...queryTools,
      ...policyTools,
      ...userTools,
      ...backupTools,
      ...systemTools,
    ];
  • src/index.ts:23-60 (registration)
    The MCP server registers all tools from ALL_TOOLS into a toolMap (line 24) and handles ListToolsRequestSchema / CallToolRequestSchema to serve and execute tools respectively.
    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 filters out null/empty values from the optional query parameters (name, state) before passing them 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 !== ''),
      );
    }
Behavior2/5

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

No annotations are present, so the description must carry the full burden. It only restates the name and lacks details about permissions, read-only nature, or behavior beyond 'get'. The tool is likely read-only, but this is not explicitly stated.

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

Conciseness4/5

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

The description is a single, focused sentence with no unnecessary words. It could be more informative, but it is not verbose.

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?

Given no output schema and simple purpose, the description minimally states what is returned (services and status). However, it lacks detail on return structure or filtering behavior, which is partially covered by the schema.

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?

Input schema covers 100% of parameters with descriptions. The description does not add additional meaning beyond the schema, so baseline 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?

The description clearly states the verb 'Get' and the resource 'Windows services' with scope 'for a device'. However, it does not differentiate from the sibling tool 'ninja_query_windows_services', which likely has similar purpose.

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 like 'ninja_query_windows_services'. There is no mention of prerequisites, context, or exclusions.

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