feat: add list_repo_contents and get_repo_tree MCP tools #117
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/OpenSpec
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
RFC - Request For Comments
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
hermes-attempted
hermes-needs-clarification
hermes-ready
hermes-review
hermes-wip
human-required
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
agentic-forges/forgejo-mcp!117
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/117/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds two new MCP tools for exploring a Forgejo repository's file structure:
list_repo_contentslists the files and directories at a given path (usepath=""to list the repository root, returning one level of entries), andget_repo_treeretrieves the Git tree at a ref, withrecursive=truereturning the complete file tree in a single response (subject to the server's tree-endpoint size cap). Tool descriptions are precise enough that an LLM can select the right tool without trial and error.Closes #115.
The pagination design for
list_repo_contentsfollows the approach recommended in the maintainer's review on #115:pageandlimitare omitted entirely fromlist_repo_contentsbecause the Forgejo SDK'sListContentsdoes not accept pagination options. Exposing phantom parameters would mislead callers — a caller passingpage=2would silently receive page 1 back with no error.get_repo_treeretainspageandlimitsinceGetTreesOptions.ListOptionsplumbs them through to a real call. Pagination parameters will be added tolist_repo_contentswhen SDK support lands.This change has been running on an internal MCP deploy since 2026-05-05 (combined with a separate plain-text fix on a different branch) and all tests pass (
go test ./...clean).Thanks for the review on both PRs!
On the two nits: agreed on both — limit=1000 makes sense for tree-sized entries
On showboat: it sounds interesting and I'd like to look into it for possible future PRs to land changes more maturely. But I'm unfamiliar with the tool and don't want to hold v2.20.0 while we get up to speed, so skipping for these two — I hope you proceed with the merge bundle as planned.
Looking forward to the release! :)