extension

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: Apache-2.0 Imports: 0 Imported by: 4

README

MCP Protocol Extensions

This package hosts optional/shared helpers that are not part of the formal Model Context Protocol specification but are useful for interoperable behaviors across clients/servers and tools.

Current extensions:

  • continuation: a reusable pagination/truncation hint (fields for hasMore, remaining/returned, nextRange/pageToken, mode, binary) that tools can attach to responses when content is clipped or paged.

Keeping extensions out of schema/ avoids conflating experimental/optional fields with the official MCP schema.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteRange

type ByteRange struct {
	Offset int `json:"offset,omitempty"`
	Length int `json:"length,omitempty"`
}

ByteRange specifies a half-open [Offset, Offset+Length) window.

type Continuation

type Continuation struct {
	// HasMore reports that more data is available beyond what was returned.
	HasMore bool `json:"hasMore,omitempty"`
	// Remaining is the estimated number of bytes (or units) not returned.
	Remaining int `json:"remaining,omitempty"`
	// Returned is the number of bytes (or units) included in this response.
	Returned int `json:"returned,omitempty"`
	// NextRange provides the next suggested byte/line window for continuation.
	NextRange *RangeHint `json:"nextRange,omitempty"`
	// PageToken is an opaque continuation token alternative to NextRange.
	PageToken string `json:"pageToken,omitempty"`
	// Mode optionally records the preview mode applied (e.g., head, tail).
	Mode string `json:"mode,omitempty"`
	// Binary indicates the returned content is a placeholder/preview for binary data.
	Binary bool `json:"binary,omitempty"`
}

Continuation describes a generic pagination/truncation hint that tools can attach to their responses. Presence of this object signals that additional data may be retrieved by following the provided range or page token.

type LineRange

type LineRange struct {
	Start int `json:"start,omitempty"`
	Count int `json:"count,omitempty"`
}

LineRange specifies a 1-based start line and count window.

type RangeHint

type RangeHint struct {
	Bytes *ByteRange `json:"bytes,omitempty"`
	Lines *LineRange `json:"lines,omitempty"`
}

RangeHint defines the next slice to fetch, expressed as bytes or lines.

Jump to

Keyboard shortcuts

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