feat(mcp): add all_projects flag to mem_search for cross-project search#332
feat(mcp): add all_projects flag to mem_search for cross-project search#332egdev6 wants to merge 11 commits intoGentleman-Programming:mainfrom
Conversation
Add optional all_projects boolean parameter to mem_search tool. When true, searches across all projects instead of restricting to current/default project. When false or omitted, maintains existing single-project behavior. Enables agents to recall architectural decisions, patterns, or context from related projects without explicit project switching. Closes Gentleman-Programming#303
There was a problem hiding this comment.
Pull request overview
Adds an all_projects flag to the MCP mem_search tool to enable cross-project (global) search behavior while preserving the existing project-scoped search behavior by default. This fits into the MCP layer’s responsibility of mapping tool arguments into store queries and returning consistent tool envelopes.
Changes:
- Extended the
mem_searchtool schema with anall_projectsboolean argument. - Updated
handleSearchto bypass project auto-detection/override validation whenall_projects=truesoStore.Search()runs globally (empty project filter). - Added an MCP test covering global vs project-scoped behavior, and documented the new parameter.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
internal/mcp/mcp.go |
Adds all_projects parameter and branches search behavior to support global search. |
internal/mcp/mcp_test.go |
Adds a unit test validating cross-project results vs project-filtered results. |
docs/AGENT-SETUP.md |
Documents how to use all_projects with mem_search. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Ready for review! |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
🔗 Linked Issue
Closes #303
🏷️ PR Type
type:bug— Bug fixtype:feature— New featuretype:docs— Documentation onlytype:refactor— Code refactoring (no behavior change)type:chore— Maintenance, dependencies, toolingtype:breaking-change— Breaking change📝 Summary
all_projectsboolean parameter tomem_searchfor cross-project lookup.false.📂 Changes
internal/mcp/mcp.goall_projectsto themem_searchschema and updatedhandleSearchto bypass project resolution for global searchinternal/mcp/mcp_test.goTestHandleSearch_AllProjectscovering global and project-scoped behaviordocs/AGENT-SETUP.mdmem_search🧪 Test Plan
go test ./...go test -tags e2e ./internal/server/...Manual verification:
all_projects: truereturns matches from multiple projects.all_projects: falsebehaves like existing single-project search.🤖 Automated Checks
These run automatically and all must pass before merge:
Closes #N/Fixes #N/Resolves #Nstatus:approvedlabeltype:*labelgo test ./...passesgo test -tags e2e ./internal/server/...passes✅ Contributor Checklist
Closes #N)type:*label to this PRgo test ./...go test -tags e2e ./internal/server/...Co-Authored-Bytrailers in commits💬 Notes for Reviewers
This change intentionally keeps the store layer untouched because global search already works when
SearchOptions.Projectis empty. The fix is isolated to the MCP layer, which previously always resolved an empty project to the current/default project.