MCP: standalone report-type job artifacts are listed but cannot be read with get_artifact_file

Split out of #631136 (closed) (side note by @EduardN in the issue description).

Problem

get_job and get_pipeline with include: ["artifacts"] list every artifact a job has, one per file_type. get_artifact_file can only read files inside the job's archive artifact (artifacts.zip).

Report-type artifacts that are uploaded as their own files, outside artifacts.zip, show up in the listing but cannot be read. Example seen in two private projects on GitLab.com: gl-dependency-scanning-report.json (file_type: dependency_scanning). Calling get_artifact_file with that path returns "not found in the artifacts archive" and lists only what is in the zip (here the CycloneDX SBOM).

So an agent is told an artifact exists but has no tool to read it. The listing and the read tool don't agree on what an "artifact" is.

Relevant code:

  • app/services/mcp/tools/jobs/get_job_service.rb (artifacts_facet): lists all job.job_artifacts
  • app/services/mcp/tools/jobs/get_artifact_file_service.rb: reads entries from the archive artifact only

Desired Outcome

  • An agent can read the content of any artifact that get_job / get_pipeline list, including standalone report artifacts such as dependency_scanning. One option: let get_artifact_file (or a new tool) select an artifact by file_type or name, not only by a path inside artifacts.zip.
  • Reading respects the same access checks (read_job_artifacts), size limits and byte paging as get_artifact_file does today.
  • If an artifact can't be read through MCP, the tool says so clearly (for example: "this is a standalone dependency_scanning report, not part of artifacts.zip"). It should not return a misleading "not found in the artifacts archive".
Edited by 🤖 GitLab Bot 🤖