Skip to main content
Glama

Create service

spm_create_service

Create and immediately start a persistent service from a command, replacing background processes for long-lived dev servers, workers, and bots that must outlive the session.

Instructions

Create a new persistent service from a command and start it immediately. By default it restarts when it exits and starts again at login, so use it instead of running long-lived processes in the background (&, nohup, start /b) for dev servers, workers and bots that must outlive the session. Use spm_start_service or spm_enable_service for a service that already exists. If the name is taken the call fails; set force=true only after the user agrees to replace that service. Put secrets in an env_file, never in command arguments. Afterwards, call spm_get_logs to confirm it started. Acts on the current user's services unless system is true; machine-wide services need root on Linux and macOS or an Administrator shell on Windows, so only use system when the user asks for it.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "command": "<command>"
    },
    "name": "spm_create_service"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory for the command. Defaults to the directory the MCP server runs in, so pass the project directory explicitly.
nameYesNew service name, unique in the scope; letters, numbers, dot, underscore and dash.
forceNoReplace an existing service with the same name. Only with the user's agreement.
systemNoManage machine-wide services instead of the current user's. Requires root or Administrator; leave false unless the user asks for system scope.
commandYesExecutable and arguments as separate array elements, for example ["npm", "run", "dev"].
restartNoWhen to restart the process after it exits.always
env_fileNoPath to a KEY=VALUE environment file loaded at start. Use this for secrets instead of putting values in MCP arguments.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • changedInput schema / properties / command / description
      Previous value: -"Executable and arguments as separate array elements."New value: +"Executable and arguments as separate array elements, for example [\"npm\", \"run\", \"dev\"]."
    • addedInput schema / properties / cwd / description
      Added value: +"Working directory for the command. Defaults to the directory the MCP server runs in, so pass the project directory explicitly."
    • changedInput schema / properties / env_file / description
      Previous value: -"Path to an environment file. Do not place secret values directly in MCP arguments."New value: +"Path to a KEY=VALUE environment file loaded at start. Use this for secrets instead of putting values in MCP arguments."
    • changedInput schema / properties / force / description
      Previous value: -"Replace an existing service definition."New value: +"Replace an existing service with the same name. Only with the user's agreement."
    • changedInput schema / properties / name / description
      Previous value: -"Managed service name."New value: +"New service name, unique in the scope; letters, numbers, dot, underscore and dash."
    • addedInput schema / properties / restart / default
      Added value: +"always"
    • addedInput schema / properties / restart / description
      Added value: +"When to restart the process after it exits."
    • changedInput schema / properties / system / description
      Previous value: -"Manage machine-wide services instead of current-user services."New value: +"Manage machine-wide services instead of the current user's. Requires root or Administrator; leave false unless the user asks for system scope."
  2. First observedv0.3.9

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations (which only say it is a non-read-only, non-open-world, non-destructive call), it discloses that the service restarts by default and starts at login, that a duplicate name makes the call fail, that replacement is gated on user agreement, and that system scope needs root or an Administrator shell. That is exactly the permission, persistence and failure context the annotations do not cover.

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?

It is front-loaded with the core action and the default behavior, then moves to alternatives, caveats and follow-up, with no filler sentences. It loses a point because the force, system and env_file guidance largely restates what the schema already says, so a bit of the length is redundant.

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

Completeness5/5

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

For a 7-parameter mutation tool with no output schema, the description covers the default lifecycle behavior, failure on name collision, privilege requirements, secret handling and a verification step. An agent has everything it needs to call this correctly and safely.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description still adds decision-level meaning: force is tied to explicit user consent, system is tied to the user's request and to privilege requirements, and env_file is framed as the only acceptable place for secrets. The restart and cwd parameters are left entirely to the schema.

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 first sentence names a specific verb ('Create'), a specific resource ('persistent service') and the immediate side effect ('start it immediately'). It also distinguishes the tool from spm_start_service and spm_enable_service, so an agent can pick it without opening the schema.

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

Usage Guidelines5/5

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

The description explicitly says when to use it (dev servers, workers, bots that must outlive the session, instead of &, nohup or start /b), when not to (existing services → spm_start_service/spm_enable_service), and the condition for force=true and system=true. It also prescribes a follow-up step (spm_get_logs) and a secrets rule.

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