refactor(sncloud): use session-bound organization and context#94
Merged
refactor(sncloud): use session-bound organization and context#94
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors StreamNative Cloud (SNCloud) MCP tools/prompts to rely more on session-bound organization/context, and introduces reusable tool/prompt constructors with accompanying tests and doc updates.
Changes:
- Replaced inline SNCloud tool/prompt definitions with reusable constructor functions and exported handlers.
- Updated SNCloud resource tools to resolve organization preferring the active SNCloud session (with fallbacks).
- Added docs updates and new unit tests covering constructors and organization resolution behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/mcp/streamnative_resources_tools.go | Refactors SNCloud resource apply/delete tools and resolves organization from session/context/options. |
| pkg/mcp/streamnative_resources_log_tools.go | Refactors SNCloud logs tool into reusable constructor + exported handler. |
| pkg/mcp/streamnative_cloud_primitives_test.go | Adds tests for new constructors and session-preferred organization resolution. |
| pkg/mcp/sncontext_tools.go | Updates available-clusters tool to use the renamed SNCloud cluster listing prompt handler. |
| pkg/mcp/prompts.go | Refactors SNCloud prompts into reusable constructors and renames prompt handlers. |
| docs/tools/streamnative_cloud.md | Updates tool docs language to reflect session-bound context. |
Comments suppressed due to low confidence (1)
pkg/mcp/streamnative_resources_log_tools.go:125
HandleSNCloudLogsreturns a non-nil Go error when the SNCloud session is missing. For MCP tool handlers in this repo, missing sessions are typically surfaced asmcp.NewToolResultError(...)with a nil error so clients get a structured tool error instead of an internal handler failure.
// Get log client from session
session := context2.GetSNCloudSession(ctx)
if session == nil {
return nil, fmt.Errorf("failed to get StreamNative Cloud session")
}
jiangpengcheng
approved these changes
Apr 20, 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.
No description provided.