Skip to main content
Glama

service_create

Create a Docker Swarm service for replicated or global scheduling, enabling rolling updates, automatic restarts, and port publishing across a swarm cluster.

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
Behavior4/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so the description's added value is the precondition about swarm manager and the return value description. It mentions it creates a service and returns the full document, but it doesn't elaborate on side effects like image pulls or synchronous vs asynchronous behavior. Still, with annotations covering the basic mutation safety profile, the description provides decent additional context.

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 somewhat long but information-dense. It is front-loaded with the core purpose and prerequisite, and the extra_kwargs examples are useful rather than filler. The structure (description → args → returns) is logical. Every sentence contributes value, though the extra_kwargs list could arguably be shortened for absolute conciseness.

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 complex tool like service_create with no output schema, the description covers all key aspects: purpose, prerequisites, alternative tools, parameter details with examples, and return type. It appropriately points to docs_lookup for edge cases, making it a complete guide for an agent to invoke the tool correctly. This is a genuinely comprehensive description.

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 description coverage is 0%, but the description fully compensates. It explains each parameter: image with example, command with allowed types, and extra_kwargs with a detailed list of common keys and example structures. It also advises using docs_lookup for unknown keys, which further guides parameter usage. This exceeds what the bare schema provides by a large margin.

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 clearly states 'Create a Swarm service' with specific verb and resource, and even notes the prerequisite of a swarm manager node. It distinguishes itself from sibling tools like container_run by explicitly mentioning this is for replicated/global scheduling, rolling updates, and automatic restart. This is unambiguous and differentiates from alternatives.

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?

It explicitly says 'Use this instead of container_run when you need replicated or global scheduling, rolling updates, or automatic restart across the swarm.' This gives direct comparison and when-to-use guidance. It also mentions the requirement of a swarm manager node and instructs to use docs_lookup for any other docker-py parameters, preventing guessing.

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/L337-org/docker-mcp'

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