Skip to content

refactor(sncloud): use session-bound organization and context#94

Merged
freeznet merged 13 commits intomainfrom
freeznet/improve-sn-cloud-tools
Apr 20, 2026
Merged

refactor(sncloud): use session-bound organization and context#94
freeznet merged 13 commits intomainfrom
freeznet/improve-sn-cloud-tools

Conversation

@freeznet
Copy link
Copy Markdown
Member

No description provided.

@freeznet freeznet self-assigned this Apr 18, 2026
Copilot AI review requested due to automatic review settings April 18, 2026 03:09
@freeznet freeznet requested a review from a team as a code owner April 18, 2026 03:09
Copy link
Copy Markdown
Contributor

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

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

  • HandleSNCloudLogs returns a non-nil Go error when the SNCloud session is missing. For MCP tool handlers in this repo, missing sessions are typically surfaced as mcp.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")
	}

Comment thread pkg/mcp/sncontext_tools.go Outdated
Comment thread pkg/mcp/streamnative_resources_log_tools.go
Comment thread pkg/mcp/streamnative_cloud_primitives_test.go
Comment thread pkg/mcp/streamnative_cloud_primitives_test.go
Comment thread pkg/mcp/streamnative_cloud_primitives_test.go
@freeznet freeznet merged commit 8eaf8d9 into main Apr 20, 2026
9 checks passed
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.

3 participants