feat(mcp): implement MVP for Resources and Prompts#42
Closed
doITmagic wants to merge 3 commits into
Closed
Conversation
- Add support for MCP Resources by exposing `ragcode://status/indexing` to provide clients with direct access to index_status.json. - Add support for MCP Prompts by registering a "System Diagnostics" prompt template. - Refactor ToolResponse ContextMetadata to remove `indexing_progress`, as this data is now properly scoped to the Resource implementation, reducing payload sizes for tool calls. - Update internal tools (`find_usages`, `smart_search`, `call_hierarchy`, `list_package_exports`) to adhere to the cleaned-up `ContextFromWorkspace`.
- Add support for MCP Resources by exposing `ragcode://status/indexing` to provide clients with direct access to index_status.json. - Add support for MCP Prompts by registering a "System Diagnostics" prompt template. - Refactor ToolResponse ContextMetadata to remove `indexing_progress`, as this data is now properly scoped to the Resource implementation, reducing payload sizes for tool calls. - Update internal tools to adhere to the cleaned-up `ContextFromWorkspace`.
There was a problem hiding this comment.
Pull request overview
Implements an MVP of MCP Resources and Prompts to move indexing progress out of tool response context payloads, reducing response sizes and enabling clients to fetch status on-demand.
Changes:
- Adds an MCP Resource (
ragcode://status/indexing) to expose workspace indexing status. - Adds an MCP Prompt (“System Diagnostics”) and registers both Resources/Prompts in the daemon.
- Removes indexing progress/status from
ToolResponse.ContextMetadataand updates tools to use the simplifiedContextFromWorkspace.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/service/tools/smart_search_pipeline.go | Stops loading/attaching indexing status in smart search response context. |
| internal/service/tools/smart_search.go | Removes indexing status from error-path context payloads. |
| internal/service/tools/skills.go | Switches tool responses to use simplified ContextFromWorkspace. |
| internal/service/tools/response.go | Removes IndexingStatus from ContextMetadata and deletes helper that attached it. |
| internal/service/tools/read_file_context.go | Uses simplified workspace context builder. |
| internal/service/tools/list_package_exports.go | Removes indexing status from response context payloads. |
| internal/service/tools/find_usages.go | Removes indexing status from response context payloads. |
| internal/service/tools/evaluate_ragcode.go | Uses simplified workspace context builder. |
| internal/service/tools/call_hierarchy.go | Removes indexing status from response context payloads. |
| internal/service/resources/resources.go | Adds MCP Resource to return indexing status JSON. |
| internal/service/prompts/prompts.go | Adds MCP Prompt template for diagnostics. |
| internal/daemon/run.go | Registers the new Resources and Prompts on daemon startup. |
Comments suppressed due to low confidence (2)
internal/service/tools/find_usages.go:106
- In the ErrNoCollectionsFound branch, the response message says the workspace is "not indexed yet" even when you flip
resp.Statustoindexing_in_progress(whenidx != nil). This yields contradictory status/message for clients. Update the message when settingindexing_in_progress(and consider attaching a hint to readragcode://status/indexingfor progress).
resp := ToolResponse{
Status: "indexing_required",
Message: fmt.Sprintf("⏳ Workspace '%s' is not indexed yet. Indexing is required for complete results.", wctx.Root),
Context: ContextFromWorkspace(wctx),
}
if idx != nil {
resp.Status = "indexing_in_progress"
}
return resp.JSON()
internal/service/tools/call_hierarchy.go:136
- When
idx != nil, this branch changesresp.Statustoindexing_in_progressbut keeps the message text that says indexing is required / not indexed yet. That mismatch can confuse clients (especially now that indexing status details were removed from ContextMetadata). Adjust the message (and optionally point toragcode://status/indexing).
resp := ToolResponse{
Status: "indexing_required",
Message: fmt.Sprintf("⏳ Workspace '%s' is not indexed yet. Indexing is required for complete call hierarchy results.", wctx.Root),
Context: ContextFromWorkspace(wctx),
}
if idx != nil {
resp.Status = "indexing_in_progress"
resp.Data = map[string]any{"indexing": idx}
}
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+26
to
+34
| status := eng.GetIndexStatus(wctx.Root) | ||
| if status == nil { | ||
| return nil, fmt.Errorf("index status not found for workspace %s", wctx.Root) | ||
| } | ||
|
|
||
| blob, err := json.MarshalIndent(status, "", " ") | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to marshal index status: %w", err) | ||
| } |
Comment on lines
+178
to
+181
| // Register Extra Features (Resources & Prompts MVP) | ||
| resources.Register(mcpServer, eng) | ||
| prompts.Register(mcpServer, eng) | ||
|
|
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
Implement MVP for MCP Resources and Prompts to test client adoption and clean up context payloads.
ragcode://status/indexingto provide clients with direct access to index_status.json.indexing_progress/IndexingStatus, as this data is now properly scoped to the Resource implementation, significantly reducing payload sizes for tool calls.find_usages,smart_search,call_hierarchy,list_package_exports,evaluate_ragcode,read_file_context,skills) to adhere to the cleaned-upContextFromWorkspace.Fixes # (Implement MVP for MCP Resources and Prompts)
Type of change
Checklist:
go fmt ./...go test ./...and they pass