Skip to content

feat(mcp): implement MVP for Resources and Prompts#42

Closed
doITmagic wants to merge 3 commits into
devfrom
feature/mcp-resources-prompts-mvp
Closed

feat(mcp): implement MVP for Resources and Prompts#42
doITmagic wants to merge 3 commits into
devfrom
feature/mcp-resources-prompts-mvp

Conversation

@doITmagic
Copy link
Copy Markdown
Owner

Description

Implement MVP for MCP Resources and Prompts to test client adoption and clean up context payloads.

  • Added support for MCP Resources by exposing ragcode://status/indexing to provide clients with direct access to index_status.json.
  • Added support for MCP Prompts by registering a "System Diagnostics" prompt template.
  • Refactored ToolResponse ContextMetadata to remove indexing_progress / IndexingStatus, as this data is now properly scoped to the Resource implementation, significantly reducing payload sizes for tool calls.
  • Updated all internal tools (find_usages, smart_search, call_hierarchy, list_package_exports, evaluate_ragcode, read_file_context, skills) to adhere to the cleaned-up ContextFromWorkspace.

Fixes # (Implement MVP for MCP Resources and Prompts)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have formatted my code with go fmt ./...
  • I have run tests go test ./... and they pass
  • I have verified integration with Ollama/Qdrant (if applicable)
  • I have updated the documentation accordingly

- 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`.
Copilot AI review requested due to automatic review settings March 15, 2026 14:32
@doITmagic doITmagic self-assigned this Mar 15, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ContextMetadata and updates tools to use the simplified ContextFromWorkspace.

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.Status to indexing_in_progress (when idx != nil). This yields contradictory status/message for clients. Update the message when setting indexing_in_progress (and consider attaching a hint to read ragcode://status/indexing for 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 changes resp.Status to indexing_in_progress but 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 to ragcode://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 thread internal/daemon/run.go
Comment on lines +178 to +181
// Register Extra Features (Resources & Prompts MVP)
resources.Register(mcpServer, eng)
prompts.Register(mcpServer, eng)

@doITmagic doITmagic closed this Mar 15, 2026
@doITmagic doITmagic deleted the feature/mcp-resources-prompts-mvp branch March 15, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants