adapter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package adapter maps envelope values onto MCP CallToolResult values from go-sdk.

Use OK and ErrorCode for shorthand handlers; Options.Text controls text content mode.

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{Text: TextFull}

DefaultOptions is the default adapter configuration.

Functions

func Error

func Error(err error) (*sdkmcp.CallToolResult, any, error)

Error converts an error into an MCP error tool result.

func ErrorCode

func ErrorCode(code string, err error) (*sdkmcp.CallToolResult, any, error)

ErrorCode builds an error CallToolResult with a stable code and message.

func ErrorCodeWithOptions

func ErrorCodeWithOptions(code string, err error, opts Options) (*sdkmcp.CallToolResult, any, error)

ErrorCodeWithOptions builds an error CallToolResult with adapter options.

func FromEnvelope

func FromEnvelope(env *envelope.Envelope) (*sdkmcp.CallToolResult, any, error)

FromEnvelope converts an envelope into an MCP CallToolResult.

func FromEnvelopeWithOptions

func FromEnvelopeWithOptions(env *envelope.Envelope, opts Options) (*sdkmcp.CallToolResult, any, error)

FromEnvelopeWithOptions converts an envelope into an MCP CallToolResult.

func OK

func OK(tool, summary string, data any, next ...string) (*sdkmcp.CallToolResult, any, error)

OK builds a success CallToolResult from tool name, summary, data, and optional next hints.

func OKWithOptions

func OKWithOptions(tool, summary string, data any, opts Options, next ...string) (*sdkmcp.CallToolResult, any, error)

OKWithOptions builds a success CallToolResult with adapter options.

Types

type Options

type Options struct {
	Text TextMode
}

Options configures adapter output.

type TextMode

type TextMode int

TextMode controls how much of the envelope appears in text content.

const (
	// TextFull marshals the full envelope JSON into text content (default).
	TextFull TextMode = iota
	// TextSummary puts only the summary line in text content.
	TextSummary
	// TextNone omits text content; structured content still carries the envelope.
	TextNone
)

Jump to

Keyboard shortcuts

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