Skip to main content
Glama

context_use

Switch the active Docker CLI context to an existing context name, so subsequent docker commands use the target environment.

Instructions

Set the active Docker context for the CLI on the host running this MCP server.

Note: this does not retarget the long-lived docker-py client - SDK-backed tools keep using the endpoint they connected to at startup. To retarget those, restart the server with a different DOCKER_HOST / DOCKER_CONTEXT. Create contexts with context_create; list them with context_list. Does not raise on a non-zero CLI exit (a missing docker binary or a timeout still raises) - inspect returncode/stderr in the result.

Args: name: Existing context name to set as default

Returns: dict: {"returncode": int, "stdout": str, "stderr": str, "truncated": bool}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.9.0

TDQS

A5/5.0
Behavior5/5

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

The description discloses important non-obvious behaviors beyond what annotations provide: non-zero CLI exits do not raise, a missing docker binary or timeout still raises, and the long-lived docker-py client is unaffected. This lets an agent interpret returncode/stderr correctly and avoid assuming SDK tools are retargeted.

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 main purpose is front-loaded, followed by compact caveats and a clear Args/Returns structure. Every sentence contributes operational detail without filler or repetition.

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 one-parameter CLI wrapper with no output schema, the description documents the parameter, the return dict, and exception/error behavior, and references relevant sibling tools. Nothing needed to call or evaluate the result is missing.

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?

The input schema only specifies that name is a required string. The description adds that it must be an existing context name and that it becomes the default, which is the key semantic information needed for correct invocation.

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?

States a specific action ('Set the active Docker context for the CLI on the host running this MCP server') with a clear resource and scope. It differentiates itself from context_create and context_list by focusing on selecting the default rather than creating or listing contexts. Unambiguous even 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?

Explicitly tells the agent to use context_create to create contexts and context_list to list them. Also warns that SDK-backed tools are not retargeted unless the server is restarted with a different DOCKER_HOST/DOCKER_CONTEXT, giving clear when-to-use vs. when-not-to-use guidance.

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