Skip to main content
Glama

service_create

Create a Docker Swarm service for replicated or global scheduling, rolling updates, and automatic restart. Specify image, command, networks, ports, resources, and restart policy.

Instructions

Create a Swarm service; requires a swarm manager node.

Use this instead of container_run when you need replicated or global scheduling, rolling updates, or automatic restart across the swarm. Common extra_kwargs keys: name (str), env (list of "KEY=VAL"), mode ({"Replicated": {"Replicas": N}} or {"Global": {}}), networks (list of network names/ids), endpoint_spec ({"Ports": [{"PublishedPort": 80, "TargetPort": 8080}]}), labels (dict), restart_policy ({"Condition": "on-failure", "MaxAttempts": 3}), resources ({"Limits": {"NanoCPUs": 500000000, "MemoryBytes": 134217728}}). For anything else docker-py's ServiceCollection.create accepts, call docs_lookup(section="services") rather than guessing a key name.

Args: image: Image to run service tasks from (e.g. "nginx:alpine") command: Override the image's default command; string or list of strings extra_kwargs: Additional docker-py ServiceCollection.create keyword arguments

Returns: dict: The created service's full document ({"ID", "Version", "Spec", ...})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYes
commandNo
extra_kwargsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.0

TDQS

A5/5.0
Behavior5/5

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

Annotations only indicate non-read-only and non-destructive, but the description adds critical behavioral context: requires a swarm manager node, and details common extra_kwargs keys that shape behavior (replicas, ports, restart policies, etc.). It fully discloses the operation's nature without contradiction.

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?

Though lengthy, every sentence adds value: purpose, usage, parameter semantics, and return type. The structure is front-loaded with the primary purpose, followed by practical examples, making it efficient for an agent to parse.

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?

The description covers prerequisites, parameter details, return format, and when to seek further documentation. With no output schema, it still provides a clear return description. No critical information is missing for correct invocation.

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

Parameters5/5

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

Schema has zero description coverage (0%), so the description must compensate. It explains each parameter (image, command, extra_kwargs) with concrete examples and even suggests docs_lookup for unknown keys. This adds substantial meaning beyond the raw 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 description explicitly states the tool creates a Swarm service and names a sibling (container_run) to distinguish itself. It clearly identifies the resource and action, making its purpose unambiguous.

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?

Provides explicit when-to-use guidance ('Use this instead of container_run when...'), lists specific scenarios, and directs users to docs_lookup for anything else. This fully informs an agent when to select this tool over alternatives.

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

Deploy Server

Other Tools