Docker System Information
docker_infoRetrieve Docker system information and statistics, including version details, disk usage, and performance metrics for monitoring and troubleshooting.
Instructions
Get Docker system information and statistics
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"type": "<type>"
},
"name": "docker_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Type of information to retrieve |
Implementation Reference
- src/index.ts:1321-1371 (registration)Registration of the 'docker_info' MCP tool, including inline schema definition and handler function that executes Docker commands based on the 'type' parameter: 'docker system info', 'docker --version && docker-compose --version', 'docker stats --no-stream', or 'docker system df', using the shared executeDockerCommand helper.
server.registerTool( "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 }; } } ); - src/index.ts:1330-1371 (handler)The handler function for docker_info tool. Takes 'type' input and runs the appropriate Docker command via executeDockerCommand, formats the output as markdown text block, handles errors.
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 }; } } ); - src/index.ts:1323-1329 (schema)Schema/metadata for docker_info tool defining title, description, and inputSchema using Zod enum for 'type' parameter.
{ 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") } },