AgentSkillsCN

log-retrieval

检索并展示 Buildkite 作业日志。如需调试失败问题,请改用构建调试功能。

SKILL.md
--- frontmatter
name: log-retrieval
description: "Retrieves and displays Buildkite job logs. For debugging failures, use build-debugging instead."

Log Retrieval

Retrieve and display job logs from Buildkite builds.

When to use

  • "Show me the logs"
  • "What did the build output?"
  • "Get the logs from job X"
  • "Search the logs for Y"
  • "What happened in the test step?"
  • /buildkite:logs

Available MCP Tools

ToolPurpose
get_buildGet build details to find job IDs
read_logsGet full log output for a job
search_logsSearch for patterns within logs
tail_logsShow last N log entries

Input Parsing

Parse from $ARGUMENTS or user's message:

Input FormatExample
Job URLhttps://buildkite.com/org/pipe/builds/123#job-uuid
Build + job namebuild 123, test step
Build number123 (then ask which job)
Description"the failed job" or "the deploy step"

Approach

  1. Identify the job

    • If just build given, fetch build and list jobs
    • Match job by name/label if specified
    • Default to failed jobs if user asks about errors
  2. Fetch logs with buildkite_read_logs

    • Get full output for the identified job
  3. Present logs appropriately

    • For short logs: show entirely
    • For long logs: show relevant section (usually end)
    • Always use code blocks
  4. Search if needed with buildkite_search_logs

    • When user is looking for specific content
    • Return matching lines with context

Output Format

text
## Logs: "Run Tests" (job abc-123)

​```
[timestamp] Installing dependencies...
[timestamp] Running test suite...
[timestamp] Error: Connection refused
[timestamp] Test failed: api.test.js
​```

Showing last 50 lines. Full log is 2,847 lines.

Search Output

When searching:

text
## Search: "error" in build 456

Found 3 matches:

**Line 234** (test step):
> Error: Cannot connect to database

**Line 567** (deploy step):
> Error: Permission denied

**Line 890** (cleanup step):
> Error: File not found (non-fatal)

When to Use This vs build-debugging

ScenarioSkill
"Why did build fail?"build-debugging
"Show me the test logs"log-retrieval
"Debug this error"build-debugging
"Search for 'timeout' in logs"log-retrieval
"What went wrong?"build-debugging
"What did the deploy output?"log-retrieval

Example Interaction

text
User: Show me the logs from the failed test

1. Get build (from context or ask)
2. Find job with "test" in name that failed
3. Fetch logs with buildkite_read_logs
4. Display relevant portion in code block