Skip to content

Feature Request: Add tool to fetch job logs by job name (avoid listing all jobs) #924

Description

@cisco-krsna

Describe the feature or problem you’d like to solve

Currently, the GitHub MCP Server exposes the following tools for working with workflow runs and jobs:

  • mcp0_list_workflow_runs
  • mcp0_list_workflow_jobs
  • mcp0_get_job_logs

To fetch logs for a particular job, an agent must:

  1. Call mcp0_list_workflow_runs to find the relevant run.
  2. Call mcp0_list_workflow_jobs with the run_id.
  3. Iterate through hundreds or even thousands of jobs to locate a job by its name.
  4. Call mcp0_get_job_logs with the job_id.

This approach works for small workflows but becomes inefficient and impractical for large workflows (e.g. 1,000+ jobs). Agents often struggle to handle such large responses, and passing the entire job list into context is wasteful.


Proposed solution

Introduce a new tool such as:

  • mcp0_get_job_logs_by_name
    • Inputs: run_id, job_name
    • Behavior: Server internally paginates jobs for the given run, finds the job with the given name, and returns its logs.

Alternatively:

  • mcp0_get_job_by_name
    • Inputs: run_id, job_name
    • Behavior: Server returns the job_id only, which can then be passed to the existing mcp0_get_job_logs.

Benefits:

  • Efficient for large workflows with hundreds/thousands of jobs.
  • Reduces token/context overhead for AI agents.
  • Keeps API usage minimal (avoids unnecessary job list retrieval).
  • Provides a clearer and more direct developer experience.

Example prompts or workflows (for tools/toolsets only)

  1. Fetch logs from a specific job in the latest successful run
    {
      "tool": "mcp0_get_job_logs_by_name",
      "arguments": {
        "run_id": 678901234,
        "job_name": "integration-tests"
      }
    }
    
  2. Get job ID by name
{
 "tool": "mcp0_get_job_by_name",
 "arguments": {
   "run_id": 678901234,
   "job_name": "build-backend"
 }
}

Simplify common workflow automation

  • “Fetch the logs for the lint job in the most recent successful run of ci.yml
  • “Retrieve job IDs for all deploy-* jobs in a workflow run.”

Additional context

  • Large enterprise workflows often include hundreds or thousands of jobs. Without server-side filtering by job name, AI agents or clients must inefficiently fetch and parse the entire list.
  • Adding a server-side helper tool would significantly improve scalability and usability.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions