Skip to main content
Glama

debugpy_debugpy_logs

Retrieve debugpy logs from Docker containers to analyze Python debugging sessions, inspect process behavior, and identify issues in containerized applications.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
containerYes
log_dirNo/tmp/debugpy-logs
tailNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'debugpy_debugpy_logs' tool. Decorated with @mcp.tool() to register it as an MCP tool. Takes container name, log_dir (defaulting to DEFAULT_DEBUGPY_LOG_DIR), and tail count. Returns a dict with ok status, file list, log contents, and helpful notes.
    @mcp.tool()
    def debugpy_debugpy_logs(container: str, log_dir: str = DEFAULT_DEBUGPY_LOG_DIR, tail: int = 200) -> dict[str, Any]:
        files = list_debugpy_log_files(container, log_dir)
        contents = read_debugpy_logs(container, log_dir, tail)
        return {
            "ok": True,
            "container": container,
            "log_dir": log_dir,
            "files": files,
            "logs": contents,
            "notes": [
                "These are debugpy-generated logs if attach used --log-to.",
                "An empty file list usually means attach has not run with logging enabled yet.",
            ],
        }
  • Helper function that lists debugpy log files in the container. Uses docker_exec to run 'find' command to locate log files in the specified directory.
    def list_debugpy_log_files(container: str, log_dir: str) -> list[str]:
        proc = docker_exec(container, f"find {shlex.quote(log_dir)} -maxdepth 1 -type f 2>/dev/null | sort", timeout=15, check=False)
        if proc.returncode != 0:
            return []
        return [line.strip() for line in proc.stdout.splitlines() if line.strip()]
  • Helper function that reads and concatenates debugpy log file contents. Uses docker_exec to run a shell command that tails each log file with a header separator.
    def read_debugpy_logs(container: str, log_dir: str, tail: int) -> str:
        cmd = (
            f"if [ -d {shlex.quote(log_dir)} ]; then "
            f"for f in $(find {shlex.quote(log_dir)} -maxdepth 1 -type f | sort); do "
            f"echo '===== '"'$f'"' ====='; tail -n {tail} \"$f\"; echo; done; "
            f"fi"
        )
        proc = docker_exec(container, cmd, timeout=30, check=False)
        return (proc.stdout or proc.stderr).strip()
  • Core helper function that executes shell commands inside a Docker container using 'docker exec'. Used by list_debugpy_log_files and read_debugpy_logs.
    def docker_exec(container: str, shell_cmd: str, *, timeout: int = DEFAULT_TIMEOUT, check: bool = True) -> subprocess.CompletedProcess[str]:
        return run(["docker", "exec", container, DEFAULT_SHELL, "-lc", shell_cmd], timeout=timeout, check=check)
  • Constant defining the default debugpy log directory path, configurable via DEBUGPY_MCP_DEBUGPY_LOG_DIR environment variable, defaults to '/tmp/debugpy-logs'.
    DEFAULT_DEBUGPY_LOG_DIR = os.getenv("DEBUGPY_MCP_DEBUGPY_LOG_DIR", "/tmp/debugpy-logs")
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/will-garrett/debugpy-mcp'

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