github-mcp-server icon indicating copy to clipboard operation
github-mcp-server copied to clipboard

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

Open cisco-krsna opened this issue 4 months ago • 1 comments

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.

cisco-krsna avatar Aug 19 '25 09:08 cisco-krsna

Current actions X-MCP-Toolsets MCP is really lacking, this post has some good suggestions.

My ask is to succinctly expose workflow Inputs in the response.

kaihendry avatar Nov 02 '25 09:11 kaihendry