Skip to main content
Glama

analyze_multistage

Analyzes a Dockerfile to determine if a multi-stage build would reduce image size and attack surface by identifying build tools and dependencies left in the final image.

Instructions

Analyzes a Dockerfile and reports whether it would benefit from a multi-stage build. Detects build-tool commands (npm install/build, mvn, gradle, go build, cargo build, pip install with compilers, dotnet build/publish, make/cmake/gcc) combined with a single-stage FROM, which usually means build tools and dev dependencies end up shipped in the final image unnecessarily — increasing image size and attack surface.

This tool only analyzes and returns reasoning plus the raw Dockerfile content — it does NOT generate the rewritten Dockerfile itself. If it reports multi-stage as recommended, use the returned content and detected build system to draft a multi-stage version yourself: a "builder" stage that runs the build commands, and a slim runtime stage that only COPYs the compiled artifact from the builder stage.

Args: dockerfile_path: full path to an existing Dockerfile on this machine. Accepts either a Windows path ("C:\path\Dockerfile") or a Git Bash style path ("/c/path/Dockerfile").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dockerfile_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

The description is transparent about the tool's behavior: it only analyzes and returns reasoning plus raw content, explicitly stating it does not generate a rewritten Dockerfile. This is a clear, non-destructive action with no hidden side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is somewhat repetitive, repeating the 'does NOT generate the rewritten Dockerfile' point twice. It could be more concise without losing clarity, but it is well-structured and logically organized.

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

Completeness4/5

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

Given that the tool has a single parameter and no output schema, the description provides sufficient context: it explains the purpose, the expected input type, the kind of output (reasoning and raw content), and how to proceed after receiving the result. The lack of an explicit output schema is mitigated by this explanation.

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 sole parameter, dockerfile_path, is thoroughly explained in the description, including what it should be (an existing Dockerfile full path) and acceptable path formats (Windows, Git Bash). This adds substantial value beyond the minimal schema definition.

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 the tool's specific function: analyzing a Dockerfile to determine if it would benefit from a multi-stage build. It also highlights the detection of build-tool commands, which distinguishes it from other Dockerfile analysis tools like scanning or linting.

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

Usage Guidelines3/5

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

The description provides guidance on post-analysis behavior (drafting a multi-stage version yourself) and clarifies what the tool does NOT do. However, it does not explicitly state when to use this tool versus other Dockerfile analysis tools (e.g., scan_dockerfile, lint_dockerfile), leaving some ambiguity.

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

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/Chandrakant1988/https-github.com-Theo-Gkisis-mcpdockery'

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