Add list_wiki_pages MCP tool and registration

What does this MR do and why?

  • Adds the list_wiki_pages MCP tool class and registers it in the MCP tools manager
    • This MR sets up the tool addition; the supporting GraphQL service introduced in !240972 (merged) is a prerequisite, please do not merge until the supporting MR is merged
      • Once the supporting MR is merged, this should be changed to point to master instead.
  • Address the following before opening for review:

note (non-blocking): I've got a few in-flight issues for code re-organization:

I do not think the either issue will be done before the next MR is ready for a review. However, it would be helpful for me if you can implement the following convention changes with the new tool. I'd also ask to use me as the maintainer reviewer.

  1. do not use graphql in the service name
  2. use a .graphql file in place of HEREDOC
  3. organize the tool into an appropriate folder for whatever data is being queried by the tool

Original comment: !240972 (comment 3486167607)

  • Update with pagination

Two things to carry into the tool MR (!240973 (merged)), not blockers here:

  1. Pagination must be surfaced, or it's a correctness problem for an agent. A >100-page wiki silently caps at the default page size; an agent then "can't find" a page that exists. The tool should expose / follow pageInfo.hasNextPage/endCursor rather than just reading nodes. (See the hasNextPage suggestion on the resolver.)
  2. slug is null: true — confirm canonical_slug is always present for listed pages, or have the tool drop null-slug rows so an agent never gets an entry it can't act on.

Original comment: !240972 (comment 3486167628)

  • Follow the tool proposal process

https://docs.gitlab.com/development/duo_agent_platform/mcp/#the-tool-proposal-process

References

  • !240972 (merged) — GraphQL service and schema changes (prerequisite)
  • Related to #601275

Screenshots or screen recordings

Duo Chat — tool working after enabling duo_workflow_mcp_enabled for the group:

Duo Chat working

Planner Agent — tool working via a custom local agent using the Planner Agent's system prompt:

Planner Agent working

Note for reviewer: This was tested using a custom agent (not a foundational agent) with the Planner Agent's system prompt copied over. The assumption is that tool exposure works the same way for foundational agents — but please verify whether this test is actually a valid simulation of how the tool would be available to the Planner Agent in practice.

Notes for reviewer

  • Feature flag: This MR does not put the new tool behind a feature flag. The tool is only reachable when directly invoked via MCP, so the risk of unintended exposure is low. Additionally, no past practice of gating new MCP tools behind feature flags was found during development. Please advise if either of these assumptions is incorrect.

How to set up and validate locally

Note: Changes from the supporting MR (!240972 (merged)) are required for this to work.

  1. Enable the MCP server at the instance level. The MCP server availability is controlled by the mcp_server_availability_setting feature flag. Enable it in a Rails console:

    Feature.enable(:mcp_server_availability_setting)

    Then in the Admin area, go to Settings > General > Visibility and access controls, and check Allow connection to GitLab under MCP client access.

  2. Enable MCP tools for your group. In your top-level group, go to Settings > GitLab Duo > Change configuration, and check Allow external MCP tools under External MCP tools.

  3. Enable the duo_workflow_mcp_enabled flag for your group in a Rails console:

    Feature.enable(:duo_workflow_mcp_enabled, Group.find_by_full_path('your-group-path'))
  4. Enable additional feature flags that may be required:

    Feature.enable(:mcp_client)
    Feature.enable(:mcp_catalog_agent_tools)
  5. Set up a custom agent in the GDK's AI Catalog to test with the Planner Agent:

    • Create a new custom agent in the local GDK AI Catalog
    • Copy the system prompt from the Planner Agent
    • Add tools for the agent — list_wiki_pages should appear in the list of available tools
    • To confirm that MCP tools are not automatically available to agents, first test the agent without adding list_wiki_pages to its tool list and verify it cannot use the tool. Then add it and confirm it works as expected.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #601275

Edited by Richard Chan

Merge request reports

Loading