Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

docker_compose_logs

View container output from docker-compose stacks to monitor application behavior and debug issues. Filter by specific services, set line limits, or view logs from specific time periods.

Instructions

View output from containers in a docker-compose stack

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
servicesNoOnly show logs for specific services
tailNoNumber of lines to show from end of logs
sinceNoShow logs since timestamp
timestampsNoShow timestamps
fileNoPath to compose file
cwdNoWorking directory

Implementation Reference

  • The main handler function that constructs and executes the docker compose logs command using dynamic flags and the executeDockerCommand helper.
    export async function dockerComposeLogs(args: z.infer<typeof dockerComposeLogsSchema>): Promise<ToolResponse> {
      const tailFlag = args.tail ? `--tail ${args.tail}` : '';
      const sinceFlag = args.since ? `--since ${args.since}` : '';
      const timestampsFlag = args.timestamps ? '-t' : '';
      const services = args.services ? args.services.join(' ') : '';
      const fileFlag = args.file ? `-f ${args.file}` : '';
      const composeCmd = await getComposeCmd();
    
      return executeDockerCommand(
        `${composeCmd} ${fileFlag} logs ${tailFlag} ${sinceFlag} ${timestampsFlag} ${services}`.trim(),
        args.cwd
      );
    }
  • Zod schema for input validation of the docker_compose_logs tool parameters.
    export const dockerComposeLogsSchema = z.object({
      services: z.array(z.string()).optional().describe('Only show logs for specific services'),
      tail: z.number().optional().describe('Number of lines to show from end of logs'),
      since: z.string().optional().describe('Show logs since timestamp'),
      timestamps: z.boolean().optional().default(false).describe('Show timestamps'),
      file: z.string().optional().describe('Path to compose file'),
      cwd: z.string().optional().describe('Working directory')
    });
  • src/index.ts:495-498 (registration)
    Dispatch logic in the main MCP server handler that validates arguments with the schema and calls the dockerComposeLogs handler function.
    if (name === 'docker_compose_logs') {
      const validated = dockerComposeLogsSchema.parse(args);
      return await dockerComposeLogs(validated);
    }
  • Tool metadata definition including name, description, and JSON input schema, included in the dockerTools array for listing available tools.
    {
      name: 'docker_compose_logs',
      description: 'View output from containers in a docker-compose stack',
      inputSchema: {
        type: 'object',
        properties: {
          services: { type: 'array', items: { type: 'string' }, description: 'Only show logs for specific services' },
          tail: { type: 'number', description: 'Number of lines to show from end of logs' },
          since: { type: 'string', description: 'Show logs since timestamp' },
          timestamps: { type: 'boolean', default: false, description: 'Show timestamps' },
          file: { type: 'string', description: 'Path to compose file' },
          cwd: { type: 'string', description: 'Working directory' }
        }
      }
    },
  • Core helper function that executes any docker command via child_process.exec and formats the response in MCP ToolResponse format.
    async function executeDockerCommand(command: string, cwd?: string): Promise<ToolResponse> {
      try {
        const { stdout, stderr } = await execAsync(command, {
          cwd: cwd || process.cwd(),
          shell: '/bin/bash',
          maxBuffer: 10 * 1024 * 1024, // 10MB buffer for logs
          timeout: 60000 // 60 second timeout for builds
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                command: command,
                stdout: stdout.trim(),
                stderr: stderr.trim(),
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: false,
                command: command,
                stdout: error.stdout?.trim() || '',
                stderr: error.stderr?.trim() || error.message,
                exitCode: error.code || 1,
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ],
          isError: true
        };
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'View output' which implies a read-only operation, but doesn't clarify if this streams logs in real-time, requires specific permissions, has rate limits, or what format the output takes. This leaves significant gaps for a tool that interacts with system resources.

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 a single, efficient sentence that immediately communicates the core functionality without any wasted words. It's perfectly front-loaded and appropriately sized for its purpose.

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

Completeness3/5

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

For a tool with 6 parameters, 100% schema coverage, and no output schema, the description provides basic purpose but lacks behavioral context. It doesn't explain what the output looks like (streaming vs static, format) or operational considerations, making it minimally adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so all parameters are documented in the schema itself. The description doesn't add any additional parameter meaning beyond what's in the schema, but since schema coverage is complete, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('View output') and resource ('containers in a docker-compose stack'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'docker_logs' or 'docker_compose_ps', which might also show container information, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'docker_logs' for single containers or 'docker_compose_ps' for status, leaving the agent to infer usage context without explicit direction.

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/ConnorBoetig-dev/mcp2'

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