Loading
Draft: [skip ci] POC Add list_saved_views and save_saved_view MCP tools
What does this MR do and why?
POC for #631461. Saved views are getting harder to configure by hand, so this adds MCP tools that let agents find, create, and update them.
Two new tools in the work_items toolset:
list_saved_views(read-only). Lists saved views in a project or group, withsearch,subscribed_only,sort, and cursor pagination. Wrapsnamespace.savedViews. It doesn't selectfiltersorfilterWarnings, because those fields can only resolve for one saved view per request.save_saved_view(write, non-destructive). Nosaved_view_idmeans create (workItemSavedViewCreate). Withsaved_view_idit updates (workItemSavedViewUpdate). This follows thesave_convention and copies thesave_work_itempattern.
Notes on save_saved_view:
filtersmaps ontoWorkItemSavedViewFilterInput. Keys can be snake_case or camelCase and are camelized before the call. That input already takes readable values likelabelName,assigneeUsernames, andmilestoneTitle, so agents don't need to look up IDs.- The response includes
filterWarnings, so an agent can see when a filter value didn't resolve. - Create defaults:
filters: {},display_settings: {},sort: CREATED_DESC.is_privatefalls back to the mutation default (true). - Governance: on update the tool names its target only by
saved_view_id, so it declarescontainer_arguments record: { saved_view_id: ... }, the same wayget_saved_view_work_itemsdoes.
Delete, subscribe, unsubscribe, and reorder are out of scope for the POC. Per the conventions, delete_saved_view would be its own tool.
Demo
Duo Agentic Chat creates a shared saved view with four filters through save_saved_view: state is open, type is Issue, labels bug and frontend, and milestone Checkout v2.4. The view then shows the 6 matching issues out of 24 open ones. Recorded on GDK.
Status
- Not tested yet. No specs run and no manual run. I need to set up Agentic AI on my GDK first.
- No unit specs for the new tool and service classes yet. Only the specs that list every tool are updated.
- An MCP Tool Proposal issue for the review board still needs to be opened.
Open questions:
- Naming:
save_saved_vieworsave_work_item_saved_view? Merge requests have their own saved views. - Is
display_settings: {}valid on create againstwork_item_user_preference_display_settings.json, and isfilters: {}accepted? I still need to check both on GDK. - On update,
filtersanddisplay_settingsreplace the existing values. Should we merge instead?
How to set up and validate locally
- Enable the MCP server on GDK. See
doc/development/duo_agent_platform/mcp/_index.md. gdk restart rails-web- Call
tools/listand confirm both tools show up. - Call
save_saved_viewwithgroup_id,name, andfilters: {"state": "opened", "label_name": ["bug"]}. - Call
save_saved_viewwith the returnedsaved_view_idand a newname. - Call
list_saved_viewsfor the group, thenget_saved_view_work_itemsfor the new view.
Related to #631461
Edited by Rajan Mistry