handler

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package handler provides MCP tool handlers for Helm operations.

Index

Constants

View Source
const (
	MaxResponseTokens = 10_000

	MaxResponseBytes = MaxResponseTokens * bytesPerToken
)

Token-based response limits. 10K tokens is a practical budget for LLM tool responses; at ~4 bytes/token that translates to 40KB of text content.

Variables

This section is empty.

Functions

func CollapseYAML

func CollapseYAML(data []byte, opts CollapseOptions) (string, bool, error)

CollapseYAML transforms YAML content with depth limiting for progressive disclosure. When depth is limited, nested structures are summarized (e.g., "object (5 keys)"). Returns the original YAML unchanged if MaxDepth is 0 (unlimited).

The second return value indicates whether any collapsing occurred. Returns an error only if the input is not valid YAML.

Types

type CollapseOptions

type CollapseOptions struct {
	// MaxDepth controls how many nesting levels to expand before summarizing.
	// 0 means unlimited (return full YAML).
	MaxDepth int

	// MaxArrayItems limits how many array items to show before truncating.
	// 0 means unlimited. Default is 3.
	MaxArrayItems int

	// ShowDefaults includes actual values. When false, shows types only.
	ShowDefaults bool

	// ShowComments preserves YAML comments in output.
	ShowComments bool
}

CollapseOptions controls how YAML is collapsed for progressive disclosure.

Depth semantics for structure { a: { b: { c: value } } }:

MaxDepth=0: Full YAML (unlimited)
MaxDepth=1: a: object (1 key)
MaxDepth=2: a:\n  b: object (1 key)
MaxDepth=3: Full expansion to c: value

func DefaultCollapseOptions

func DefaultCollapseOptions() CollapseOptions

DefaultCollapseOptions returns the default options for collapsing YAML.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler provides MCP tool handlers backed by a Helm service.

func New

func New(svc helm.ChartService, logger *zap.Logger) *Handler

New creates a new Handler.

func (*Handler) Register

func (h *Handler) Register(s *mcp.Server)

Register registers all Helm tools with the MCP server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL