Add list_wiki_pages MCP tool and registration
What does this MR do and why?
- Adds the
list_wiki_pagesMCP 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.
- 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
- Address the following before opening for review:
note (non-blocking): I've got a few in-flight issues for code re-organization:
- Reorganize Mcp::Tools by domain and drop the re... (#603096 - closed)
- Move MCP tool GraphQL queries into .graphql fil... (#603389 - closed)
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.
- do not use
graphqlin the service name- use a
.graphqlfile in place ofHEREDOC- 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:
- 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/endCursorrather than just readingnodes. (See thehasNextPagesuggestion on the resolver.)slugisnull: true— confirmcanonical_slugis 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:
Planner Agent — tool working via a custom local agent using the Planner Agent's system prompt:
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.
-
Enable the MCP server at the instance level. The MCP server availability is controlled by the
mcp_server_availability_settingfeature 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.
-
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.
-
Enable the
duo_workflow_mcp_enabledflag for your group in a Rails console:Feature.enable(:duo_workflow_mcp_enabled, Group.find_by_full_path('your-group-path')) -
Enable additional feature flags that may be required:
Feature.enable(:mcp_client) Feature.enable(:mcp_catalog_agent_tools) -
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_pagesshould 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_pagesto 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

