tools

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInput = errors.New("invalid input")

ErrInput marks validation failures that the caller can fix by changing its input.

Functions

This section is empty.

Types

type AttributeKey

type AttributeKey struct {
	Key     string `json:"key"`
	Count   int64  `json:"count"`
	Example string `json:"example"`
}

type Column

type Column struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type Common

type Common struct {
	Service string `json:"service,omitempty" jsonschema:"Only include this service name."`
	Window
}

type DescribeSchemaInput

type DescribeSchemaInput struct {
	Service   string `json:"service,omitempty" jsonschema:"Only count attribute keys for this service."`
	EventName string `json:"event_name,omitempty" jsonschema:"Only count log attribute keys for this event name; spans are unaffected."`
}

type FindSpansInput

type FindSpansInput struct {
	Common
	Limit         int               `json:"limit,omitempty" jsonschema:"Maximum rows to return. Defaults to 100, capped at 500."`
	Name          string            `json:"name,omitempty" jsonschema:"Case-insensitive substring of the span name."`
	Kind          string            `json:"kind,omitempty" jsonschema:"Span kind: internal, server, client, producer, consumer or unspecified."`
	Status        string            `json:"status,omitempty" jsonschema:"Span status: unset, ok or error."`
	HTTPRoute     string            `json:"http_route,omitempty" jsonschema:"Exact http.route value."`
	MinDurationMS int64             `json:"min_duration_ms,omitempty" jsonschema:"Only spans at least this many milliseconds long."`
	Attrs         map[string]string `json:"attrs,omitempty" jsonschema:"Attribute key to exact value pairs that must all match."`
}

type GetTraceInput

type GetTraceInput struct {
	TraceID  string `json:"trace_id" jsonschema:"Trace ID as 32 hex characters."`
	Service  string `json:"service,omitempty" jsonschema:"Only include this service name."`
	MaxSpans int    `json:"max_spans,omitempty" jsonschema:"Maximum spans to return, ordered by start time. Defaults to 1000, capped at 1000."`
	// A pointer so an omitted field defaults to true.
	IncludeLogs *bool `json:"include_logs,omitempty" jsonschema:"Also return logs correlated by trace_id. Defaults to true."`
}

type ListServicesInput

type ListServicesInput struct {
	Window
}

type Rows

type Rows struct {
	Rows      []map[string]any `json:"rows"`
	Truncated bool             `json:"truncated"`
	Note      string           `json:"note"`
}

type Runner

type Runner struct {
	Eng *engine.Engine
	Now func() time.Time
	// Service is non-empty when Eng is scoped to that service.
	Service string
}

func (*Runner) DescribeSchema

func (r *Runner) DescribeSchema(ctx context.Context, in DescribeSchemaInput) (SchemaOutput, error)

func (*Runner) FindSpans

func (r *Runner) FindSpans(ctx context.Context, in FindSpansInput) (Rows, error)

func (*Runner) GetTrace

func (r *Runner) GetTrace(ctx context.Context, in GetTraceInput) (TraceOutput, error)

func (*Runner) ListServices

func (r *Runner) ListServices(ctx context.Context, in ListServicesInput) (Rows, error)

func (*Runner) SQL

func (r *Runner) SQL(ctx context.Context, in SQLInput) (Rows, error)

func (*Runner) SearchLogs

func (r *Runner) SearchLogs(ctx context.Context, in SearchLogsInput) (Rows, error)

type SQLInput

type SQLInput struct {
	Query string `json:"query" jsonschema:"A single SELECT statement over the logs and spans views."`
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum rows to return. Defaults to 100, capped at 500."`
}

type SchemaOutput

type SchemaOutput struct {
	Logs      SignalSchema `json:"logs"`
	Spans     SignalSchema `json:"spans"`
	Truncated bool         `json:"truncated"`
	Note      string       `json:"note"`
}

type SearchLogsInput

type SearchLogsInput struct {
	Common
	Limit       int               `json:"limit,omitempty" jsonschema:"Maximum rows to return. Defaults to 20, capped at 500."`
	MinSeverity string            `json:"min_severity,omitempty" jsonschema:"Minimum severity: a number 1-24 or one of trace, debug, info, warn, error, fatal."`
	Text        string            `json:"text,omitempty" jsonschema:"Case-insensitive substring of the log body."`
	Regex       string            `json:"regex,omitempty" jsonschema:"RE2 regular expression matched against the log body."`
	EventName   string            `json:"event_name,omitempty" jsonschema:"Exact event name."`
	TraceID     string            `json:"trace_id,omitempty" jsonschema:"Trace ID as 32 hex characters."`
	SessionID   string            `json:"session_id,omitempty" jsonschema:"Exact session ID."`
	Attrs       map[string]string `json:"attrs,omitempty" jsonschema:"Attribute key to exact value pairs that must all match."`
}

type SignalSchema

type SignalSchema struct {
	Columns          []Column       `json:"columns"`
	TopAttributeKeys []AttributeKey `json:"top_attribute_keys"`
}

type TraceOutput

type TraceOutput struct {
	Spans     []map[string]any `json:"spans"`
	Logs      []map[string]any `json:"logs"`
	Truncated bool             `json:"truncated"`
	Note      string           `json:"note"`
}

type Window

type Window struct {
	Since string `` /* 143-byte string literal not displayed */
	Until string `` /* 137-byte string literal not displayed */
}

Directories

Path Synopsis
Package toolstest builds a synthetic data dir for tests of the typed tools and the MCP server.
Package toolstest builds a synthetic data dir for tests of the typed tools and the MCP server.

Jump to

Keyboard shortcuts

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