Help us shape the future of Go! Take the 2026 Go Developer Survey

mcp

package
v0.0.0-...-520fc63 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const AppMIME = mcpAppMIME
View Source
const ProtocolVersion = "2026-07-28"
View Source
const UIExtension = mcpUIExtension

Variables

This section is empty.

Functions

func AppOnly

func AppOnly(meta mcp.Meta) bool

Shared with the in-process agent catalog; protocol visibility is identical.

func ReadHTTPMessage

func ReadHTTPMessage(r *http.Request) (jsonrpc.Message, error)

ReadHTTPMessage preserves the body for the SDK and excludes JSON-RPC batches.

func RequiredToolScope

func RequiredToolScope(name string) string

RequiredToolScope reports additional delegated scope needed by a tool. All remote MCP requests already require telemetry:read.

func WriteHTTPMessageError

func WriteHTTPMessageError(w http.ResponseWriter, err error)

Types

type DashboardCreateInput

type DashboardCreateInput struct {
	Dashboard query.Dashboard `json:"dashboard" jsonschema:"Complete v1 dashboard spec"`
}

type DashboardEditInput

type DashboardEditInput struct {
	ID          string                `json:"id" jsonschema:"Dashboard ID"`
	Operations  []dashboard.Operation `json:"operations" jsonschema:"Edits applied in order, atomically"`
	BaseVersion int                   `json:"base_version,omitempty" jsonschema:"Version you read; the call fails if someone saved since"`
	Message     string                `json:"message,omitempty" jsonschema:"One line describing the change, shown in history"`
}

type DashboardIDInput

type DashboardIDInput struct {
	ID string `json:"id" jsonschema:"Dashboard ID returned by list_dashboards or create_dashboard"`
}

type DashboardReplaceInput

type DashboardReplaceInput struct {
	ID          string          `json:"id" jsonschema:"Dashboard ID"`
	Dashboard   query.Dashboard `json:"dashboard" jsonschema:"Complete replacement spec; omitted panels are removed"`
	BaseVersion int             `json:"base_version,omitempty" jsonschema:"Version you read; the call fails if someone saved since"`
	Message     string          `json:"message,omitempty" jsonschema:"One line describing the change, shown in history"`
}

type DashboardRestoreInput

type DashboardRestoreInput struct {
	ID      string `json:"id" jsonschema:"Dashboard ID"`
	Version int    `json:"version" jsonschema:"Positive stored version to restore; restoring creates a new version"`
}

type DependencyInput

type DependencyInput struct {
	Window    string `json:"window,omitempty" jsonschema:"Bounded telemetry window, defaults to 1h"`
	Namespace string `json:"namespace,omitempty" jsonschema:"Filter by namespace; traversal always keeps namespaces separate"`
	Service   string `json:"service" jsonschema:"Root service name"`
	Direction string `json:"direction,omitempty" jsonschema:"upstream or downstream; defaults to downstream"`
	MaxDepth  int    `json:"max_depth,omitempty" jsonschema:"Maximum hops from 1 to 32; defaults to 8"`
	MaxNodes  int    `json:"max_nodes,omitempty" jsonschema:"Maximum accumulated nodes from 1 to 500 including roots; defaults to 100"`
}

type FragmentView

type FragmentView struct {
	Kind string `json:"kind" jsonschema:"View kind: preset or query"`
	Key  string `json:"key" jsonschema:"Stable SHA-256 hash of the view specification, captured window and variables"`
}

type IntelligenceSnapshots

type IntelligenceSnapshots interface {
	LatestSnapshot() *intelligence.Snapshot
}

type LogsInput

type LogsInput struct {
	From      *time.Time `json:"from,omitempty" jsonschema:"Absolute start, RFC3339Nano; requires to and excludes window"`
	To        *time.Time `json:"to,omitempty" jsonschema:"Absolute end, RFC3339Nano; requires from and excludes window"`
	Window    string     `json:"window,omitempty" jsonschema:"Time window such as 15m, 1h, 24h, 168h, or 720h; defaults to 1h"`
	Namespace string     `json:"namespace,omitempty" jsonschema:"OpenTelemetry service namespace; empty queries all namespaces"`
	Service   string     `json:"service,omitempty" jsonschema:"Optional exact OpenTelemetry service name"`
	Severity  string     `json:"severity,omitempty" jsonschema:"Optional exact severity such as ERROR, WARN, or INFO"`
	Search    string     `json:"search,omitempty" jsonschema:"Optional case-insensitive text contained in the log body, at most 200 characters"`
	Limit     int        `json:"limit,omitempty" jsonschema:"Maximum log entries to return, from 1 to 500"`
}

type PanelFragment

type PanelFragment struct {
	View      FragmentView                                     `json:"view"`
	Dashboard query.Dashboard                                  `json:"dashboard"`
	Results   []query.Result                                   `json:"results"`
	Vars      map[string]query.Value                           `json:"vars,omitempty"`
	Trace     *observability.Result[observability.TraceDetail] `json:"trace,omitempty"`
}

type PanelPreview

type PanelPreview struct {
	ID        string          `json:"id"`
	Status    string          `json:"status" jsonschema:"ok, empty, error, invalid or not_run"`
	Rows      int             `json:"rows,omitempty"`
	Columns   []string        `json:"columns,omitempty"`
	Sample    [][]any         `json:"sample,omitempty"`
	Interval  string          `json:"interval,omitempty"`
	Diagnosis string          `json:"diagnosis,omitempty"`
	Error     string          `json:"error,omitempty"`
	Problems  []query.Problem `json:"problems,omitempty"`
	ElapsedMS *int64          `json:"elapsed_ms,omitempty" jsonschema:"Execution duration in milliseconds; omitted for invalid or not_run panels"`
}

type PerformanceInput

type PerformanceInput struct {
	From      *time.Time `json:"from,omitempty" jsonschema:"Absolute start, RFC3339Nano; requires to and excludes window"`
	To        *time.Time `json:"to,omitempty" jsonschema:"Absolute end, RFC3339Nano; requires from and excludes window"`
	Window    string     `json:"window,omitempty" jsonschema:"Time window such as 15m, 1h, 24h, 168h, or 720h; defaults to 1h"`
	Namespace string     `json:"namespace,omitempty" jsonschema:"OpenTelemetry service namespace; empty queries all namespaces"`
	Service   string     `json:"service,omitempty" jsonschema:"Optional exact OpenTelemetry service name; omit for the whole system"`
	Limit     int        `json:"limit,omitempty" jsonschema:"Maximum operations to return, from 1 to 500"`
}

type PreviewInput

type PreviewInput struct {
	Panels    []query.Panel     `json:"panels" jsonschema:"Panels to check and run, in the same format as dashboard panels"`
	Variables []query.Variable  `json:"variables,omitempty" jsonschema:"Variables the panels reference"`
	Time      *query.Time       `json:"time,omitempty" jsonschema:"Time range; default the last hour"`
	Vars      map[string]string `json:"vars,omitempty" jsonschema:"Variable values to preview with; $__all selects All"`
}

type PreviewOutput

type PreviewOutput struct {
	ElapsedMS int64           `json:"elapsed_ms"`
	Panels    []PanelPreview  `json:"panels"`
	Problems  []query.Problem `json:"problems,omitempty"`
}

type QueryInput

type QueryInput struct {
	From      *time.Time `json:"from,omitempty" jsonschema:"Absolute start, RFC3339Nano; requires to and excludes window"`
	To        *time.Time `json:"to,omitempty" jsonschema:"Absolute end, RFC3339Nano; requires from and excludes window"`
	Window    string     `json:"window,omitempty" jsonschema:"Time window such as 15m, 1h, 24h, 168h, or 720h; defaults to 1h"`
	Namespace string     `json:"namespace,omitempty" jsonschema:"OpenTelemetry service namespace; empty queries all namespaces"`
	Limit     int        `json:"limit,omitempty" jsonschema:"Maximum services or edges to return, from 1 to 500"`
}

type QueryTelemetryInput

type QueryTelemetryInput struct {
	Panel     query.Panel            `json:"panel" jsonschema:"One v1 panel to display in the answer"`
	Text      string                 `` /* 146-byte string literal not displayed */
	Variables []query.Variable       `json:"variables,omitempty" jsonschema:"Optional v1 variable definitions used by this panel"`
	Time      *query.Time            `json:"time,omitempty" jsonschema:"Optional dashboard time override: exact from/to or a relative range"`
	Vars      map[string]query.Value `json:"vars,omitempty" jsonschema:"Resolved variable values: strings or lists; preserves $__all and empty lists"`
}

type QueryTelemetryOutput

type QueryTelemetryOutput struct {
	*PanelFragment
	Notices  []fanql.Notice `json:"notices,omitempty"`
	Error    *fanql.Failure `json:"error,omitempty"`
	Problems query.Problems `json:"problems,omitempty"`
}

QueryTelemetryOutput includes FanQL failures without changing preset fragments.

type SchemaInput

type SchemaInput struct {
	Window    string `json:"window,omitempty" jsonschema:"5m, 15m, 1h, 3h, 6h, 12h or 24h; default 1h"`
	Namespace string `json:"namespace,omitempty" jsonschema:"Limit discovery to one service namespace"`
}

type Server

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

func NewWithIntelligence

func NewWithIntelligence(queries Observability, dashboards *dashboard.Service, panels *query.Executor, snapshots IntelligenceSnapshots, version string) *Server

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() http.Handler

func (*Server) MCP

func (s *Server) MCP() *mcp.Server

type ToolDoc

type ToolDoc struct {
	Name        string
	Title       string
	Description string
	AppOnly     bool
	ResourceURI string

	// ReadOnly is the server's own readOnlyHint.
	ReadOnly bool
	// Destructive is meaningful only when ReadOnly is false. The MCP spec
	// defaults it to true when the server sends no hint, which is the safe
	// reading and the one published.
	Destructive bool
	// Idempotent is meaningful only when ReadOnly is false.
	Idempotent bool
	// OpenWorld reports whether the tool may reach beyond this instance. The
	// spec defaults it to true when absent.
	OpenWorld bool

	Inputs []ToolInput
}

ToolDoc is what a reader needs before pointing an agent at a tool: what it is called, what it does, whether it changes anything, and what it accepts.

func DescribeTools

func DescribeTools(ctx context.Context) ([]ToolDoc, error)

DescribeTools reports every tool this server exposes, as the server itself reports them over MCP.

The server is constructed with no query backend and an empty dashboard service because registration touches neither: the tool set is fixed at construction and no handler runs here. A nil dashboard service would register no dashboard tools at all, so one is supplied — otherwise this would quietly document a smaller surface than an instance serves.

type ToolInput

type ToolInput struct {
	Name        string
	Type        string
	Description string
	Required    bool
}

ToolInput is one top-level parameter. Nested object properties are not flattened — a JSON Schema is the precise artefact and a table is not the place to restate one, so a nested input is published with its own type and description and a client reads the schema for the rest.

type TraceInput

type TraceInput struct {
	From      *time.Time `json:"from,omitempty" jsonschema:"Absolute start, RFC3339Nano; requires to and excludes window"`
	To        *time.Time `json:"to,omitempty" jsonschema:"Absolute end, RFC3339Nano; requires from and excludes window"`
	Window    string     `json:"window,omitempty" jsonschema:"Trace lookup window such as 1h, 24h, 168h, or 720h; defaults to 1h"`
	Namespace string     `json:"namespace,omitempty" jsonschema:"OpenTelemetry service namespace; empty queries all namespaces"`
	TraceID   string     `json:"trace_id,omitempty" jsonschema:"Exact trace ID; omit to inspect the most relevant recent error or slow trace"`
	Service   string     `json:"service,omitempty" jsonschema:"Optional service filter when choosing a recent trace"`
	Limit     int        `json:"limit,omitempty" jsonschema:"Maximum spans and correlated logs to return, from 1 to 500"`
}

Jump to

Keyboard shortcuts

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