Skip to main content
Glama

compose_port

Read-only

Resolve the host address and port that a service's container port is published on, enabling external access to internal services.

Instructions

Resolve the host binding for a service's container port.

The compose equivalent of docker port: which host address/port a service's private port is published on. published is None when the port isn't published. For non-compose containers read container_inspect's NetworkSettings.Ports instead. Raises RuntimeError if the CLI call fails.

args: service - Service name from the compose file private_port - The container-internal port to look up protocol - "tcp" (default) or "udp" index - Container index when the service has multiple replicas (default 1) project_dir - Dir with the compose file (default: server cwd; copied to the target host if no local plugin) files - Explicit compose file paths (repeatable, -f) project_name - Compose project name override returns: dict - {"service", "private_port", "protocol", "published": "host:port"|None, "host": str|None, "port": int|None, "bindings": list[str]}. published/host/port describe the first binding; bindings lists every line (a port can be published on more than one address, e.g. IPv4 and IPv6).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesNo
indexNo
serviceYes
protocolNotcp
project_dirNo
private_portYes
project_nameNo
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, but the description adds valuable behavioral context: it explains the published=None case, the RuntimeError on CLI failure, and the exact return schema. It also notes project_dir is copied to the target host when no local plugin exists, which goes beyond annotation data.

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?

The description is front-loaded with purpose, then organized into args and returns sections. Every line earns its place: parameter meanings, defaults, exceptions, and return semantics. It is detailed but not redundant with the schema.

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 tool with 7 params, no output schema, and no enum constraints, the description provides everything an agent needs to select and invoke correctly: purpose, alternatives, failure behavior, param semantics, and return structure. It is complete for safe, correct use.

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%, so the description must carry the full parameter burden. It does so thoroughly: each of the 7 parameters is named with meaning and defaults (protocol, index, project_dir, files repeatable, project_name override). The return dict is also fully documented.

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 opens with a specific verb 'Resolve' and resource 'host binding for a service's container port', clearly distinguishing it from container-level tools. It also frames it as 'The compose equivalent of `docker port`', which disambiguates it from sibling compose commands.

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 states when not to use this tool: 'For non-compose containers read `container_inspect`'s NetworkSettings.Ports instead.' This gives a clear alternative and contextual boundary, which is exactly the kind of guidance needed.

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