fix(mcp): support recursive directory deletion in forget tool#1935
Merged
ZaynJarvis merged 1 commit intovolcengine:mainfrom May 9, 2026
Merged
fix(mcp): support recursive directory deletion in forget tool#1935ZaynJarvis merged 1 commit intovolcengine:mainfrom
ZaynJarvis merged 1 commit intovolcengine:mainfrom
Conversation
The MCP `forget` tool only forwarded `uri` to `fs.rm` and never set `recursive`, so any directory URI hit a `FailedPreconditionError` from `VikingFS.rm`. Docs and the REST DELETE endpoint already advertised directory deletion, leaving MCP clients without an equivalent. Add an optional `recursive` parameter to the MCP tool (default False to preserve fail-closed behavior on accidental tree deletes), update the zh/en MCP integration tables, and cover both directory paths in tests. Fixes volcengine#1928
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
ZaynJarvis
approved these changes
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The MCP
forgettool only forwardeduritoservice.fs.rm, never exposing or forwarding arecursiveflag. The underlyingVikingFS.rmraisesFailedPreconditionError("Cannot remove directory without --recursive: ...")whenever the target is a directory, so any directory URI passed toforgetfailed — contradicting the documented behavior ("Delete anyviking://URI") and diverging from the RESTDELETE /api/v1/fs?recursive=...endpoint and theov rmCLI.Related Issue
Fixes #1928
Type of Change
Changes Made
openviking/server/mcp_endpoint.py: add an optionalrecursive: bool = Falseparameter toforgetand forward it toservice.fs.rm. The docstring only gains one short sentence about the new flag to keep the MCP tool description token cost minimal.tests/server/test_mcp_endpoint.py: addtest_forget_directory_without_recursive_fails(expectsFailedPreconditionError) andtest_forget_directory_with_recursive_succeeds.docs/zh/guides/06-mcp-integration.mdanddocs/en/guides/06-mcp-integration.md: list the optionalrecursiveparameter forforgetin the MCP tool table and note that directory deletion requiresrecursive=true.The default stays
False, matching the REST API and theov rmCLI, so an agent cannot accidentally wipe a directory tree without an explicit user request.Testing
pytest tests/server/test_mcp_endpoint.py -x -q-> 32 passed.Checklist