Skip to main content
Glama
heresun

OrbStack MCP Server

by heresun

orbstack_docker_logs

Retrieve Docker container logs to monitor application output and debug issues. Specify container ID/name and number of lines to view recent activity.

Instructions

获取 Docker 容器的日志输出。

Args: params: 包含容器标识和日志行数

Returns: str: 容器日志

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The async function `orbstack_docker_logs` that executes the docker logs command.
    async def orbstack_docker_logs(params: DockerLogsInput) -> str:
        """获取 Docker 容器的日志输出。
    
        Args:
            params: 包含容器标识和日志行数
    
        Returns:
            str: 容器日志
        """
        args = ["logs", "--tail", str(params.tail), params.container]
        code, stdout, stderr = await _run_docker(args)
        if code != 0:
            return _format_error(stderr)
        output = stdout or stderr  # 有些程序输出到 stderr
  • The tool registration using the `@mcp.tool` decorator.
    @mcp.tool(
        name="orbstack_docker_logs",
        annotations={
            "title": "查看容器日志",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False,
        },
    )
  • The Pydantic schema `DockerLogsInput` defining the input parameters for the tool.
    class DockerLogsInput(BaseModel):
        """获取容器日志的输入参数"""
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
    
        container: str = Field(
            ...,
            description="容器 ID 或名称",
            min_length=1,
        )
        tail: Optional[int] = Field(

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/heresun/orbstack-mcp'

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