Skip to main content
Glama

docker_info

Retrieve Docker system information, version details, container statistics, or disk usage data to monitor and manage Docker environments.

Instructions

Get Docker system information and statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesType of information to retrieve

Implementation Reference

  • Handler for the docker_info tool: executes specific Docker system commands based on input 'type' (info, version, stats, disk_usage), captures output using executeDockerCommand, and returns formatted text response or error.
    try { let command: string; switch (type) { case "info": command = "docker system info"; break; case "version": command = "docker --version && docker-compose --version"; break; case "stats": command = "docker stats --no-stream"; break; case "disk_usage": command = "docker system df"; break; } const result = await executeDockerCommand(command); return { content: [ { type: "text", text: `Docker ${type}:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting Docker information: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
  • Schema definition for docker_info tool including title, description, and inputSchema with 'type' enum.
    title: "Docker System Information", description: "Get Docker system information and statistics", inputSchema: { type: z.enum(["info", "version", "stats", "disk_usage"]).describe("Type of information to retrieve") } }, async ({ type }) => {
  • src/index.ts:1322-1372 (registration)
    Registration of the 'docker_info' tool on the MCP server with name, schema, and handler function.
    "docker_info", { title: "Docker System Information", description: "Get Docker system information and statistics", inputSchema: { type: z.enum(["info", "version", "stats", "disk_usage"]).describe("Type of information to retrieve") } }, async ({ type }) => { try { let command: string; switch (type) { case "info": command = "docker system info"; break; case "version": command = "docker --version && docker-compose --version"; break; case "stats": command = "docker stats --no-stream"; break; case "disk_usage": command = "docker system df"; break; } const result = await executeDockerCommand(command); return { content: [ { type: "text", text: `Docker ${type}:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting Docker information: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );
  • Helper function executeDockerCommand used by the docker_info handler to run shell commands via promisified child_process.exec.
    async function executeDockerCommand(command: string): Promise<{ stdout: string; stderr: string }> { try { const result = await execAsync(command); return result; } catch (error: any) { throw new Error(`Docker command failed: ${error.message}`); } }

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/TauqeerAhmad5201/docker-mcp-extension'

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