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

mcp

package
v1.0.0-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package mcp is the SDK-free core of the Pulse MCP surface. It defines the public typed contract for every registered tool — an exported In/Out struct pair per tool — and reflects an input + output JSON Schema for each at package-init time, carrying both as json.RawMessage.

The package imports NO MCP SDK. It depends only on the Pulse domain packages (types, descriptor, errors, imports, examples, skills, the root facade) plus the schema reflector github.com/google/jsonschema-go. A thin adapter (mcp/gosdk, a later story) mounts these descriptors onto a caller-supplied go-sdk server via the low-level Server.AddTool path, which accepts any value that JSON-marshals to a valid 2020-12 schema — exactly the json.RawMessage this package emits. Keeping the schema carrier type-erased is what lets external programs import the contract without pulling an MCP SDK.

Recursive-type note: jsonschema-go's reflector returns an error on a Go-level type cycle (and the go-sdk generic AddTool would turn that into a panic). The payload request/response types referenced below (types.Request, types.Response, types.ComposedResponse, the Crosstab matrix, overlay layers) are non-cyclic at the Go level, so direct reflection succeeds. Were a future field to introduce a cycle, type it as any / json.RawMessage in the In/Out struct so reflection stays error-free. The init-time reflection records any error per tool (see schema.go) so the unit test fails loudly rather than the package panicking.

Index

Constants

View Source
const DefaultReturnPreset = types.ReturnPresetStandard

DefaultReturnPreset is the built-in MCP default.

Variables

This section is empty.

Functions

func Bind added in v0.5.0

func Bind(schema *encoding.Schema) (map[string]json.RawMessage, error)

Bind returns per-tool JSON Schemas keyed by tool name with no embedder extensions applied. Equivalent to BindWithExtensions with a nil snapshot.

func BindForInstance

func BindForInstance(schema *encoding.Schema, inst *descx.InstanceSnapshot) (map[string]json.RawMessage, error)

BindForInstance is BindWithExtensions scoped to one instance: every operator / overlay-kind enum keeps only the names inst enables (plus its visible extension names), the labels table enum is absent when capability:labels is hidden, and a request slot the instance hides is dropped from the schema. A hidden name is therefore advertised exactly as a never-registered one. A nil or unscoped inst is byte-identical to BindWithExtensions(schema, inst.Extensions()).

func BindForInstanceWithJoins

func BindForInstanceWithJoins(schema *encoding.Schema, joins []JoinTarget, inst *descx.InstanceSnapshot) (map[string]json.RawMessage, error)

BindForInstanceWithJoins is BindForInstance for a cohort the session joins (#260). The request-carrying tools (pulse_process, pulse_predict, pulse_compose, pulse_process_chain) widen every field enum with each target's joined names (`as` + right field, the names predict resolves against the joined schema), bind joins[].on[].right_field to the targets' own fields and keep left_field left-only. pulse_sample, pulse_facet and pulse_facet_schema read the bound cohort alone and stay unwidened. A nil target schema is skipped; with capability:joins hidden no target widens anything. No targets is byte-identical to BindForInstance.

func BindWithExtensions added in v0.7.0

func BindWithExtensions(schema *encoding.Schema, snap *descx.ExtensionsSnapshot) (map[string]json.RawMessage, error)

BindWithExtensions returns per-tool JSON Schemas keyed by tool name, merging any embedder-registered operator names into the per-category enums so LLM agents can author requests that reference custom operators. Empty schemas are omitted so the caller can decide which tools to override. SDK-free: the go-sdk adapter consumes the returned map. Unscoped: equivalent to BindForInstance with no feature profile.

Types

type ComposeIn

type ComposeIn = types.ComposedRequest

ComposeIn is the input contract for pulse_compose.

type ComposeOut

type ComposeOut = types.ComposedResponse

ComposeOut is the output contract for pulse_compose.

func HandleCompose

func HandleCompose(ctx context.Context, p *pulse.Pulse, in ComposeIn) (ComposeOut, error)

HandleCompose runs pulse_compose: multi-request batch + overlay fold.

type Config

type Config struct {
	Version string

	// DefaultReturn is the `return` preset an MCP request without its
	// own block is shaped by (return_default.go). Empty defers to the
	// instance default (pulse.Options.DefaultReturn, else the feature
	// profile's `return`), else the built-in `standard`. `full` restores
	// the library's unshaped output.
	DefaultReturn types.ReturnPreset
}

Config carries the runtime configuration baked into the tool catalog at construction time. It exists so the catalog has NO dependency on process globals or package-level build state — everything a tool closure needs is threaded in explicitly.

Version is the server/build identity string. No built-in tool surfaces it today, but the adapter (mcp/gosdk) reads it to populate the MCP server's Implementation.Version rather than a package-level constant. Reserved here so the single Config value is the one place runtime identity is injected.

func (Config) Validate

func (c Config) Validate(inst *descx.InstanceSnapshot) error

Validate refuses a Config whose DefaultReturn is not a known preset (PULSE_RETURN_INVALID, the resolver's own error). Empty is valid.

type DedupIn

type DedupIn struct {
	Path          string          `` /* 168-byte string literal not displayed */
	Groups        []pio.GroupDecl `` /* 546-byte string literal not displayed */
	SuggestGroups bool            `` /* 407-byte string literal not displayed */
	Out           string          `` /* 287-byte string literal not displayed */
}

DedupIn is the input contract for pulse_dedup.

The slot policy is pulse_import's (see the note above): groups and suggest_groups earn slots because they are the only way to write, or even see, a deduplicated cohort over MCP; the ratio floor and strict mode change no byte written, so an agent reading group_warnings holds both already; constant elision stays CLI + library only — it is an at-rest opt-in the user makes deliberately (`pulse dedup --elide-constants`). out is the one slot pulse_import has no need of: it is how an agent converts WITHOUT destroying the original.

type DedupOut

type DedupOut = pulse.DedupResult

DedupOut is the output contract for pulse_dedup.

func HandleDedup

func HandleDedup(ctx context.Context, p *pulse.Pulse, in DedupIn) (DedupOut, error)

HandleDedup runs pulse_dedup: retro-dedup of an existing cohort, or (suggest_groups alone) candidate detection over it.

type DropIn

type DropIn struct {
	Handle string `json:"handle" jsonschema:"Managed handle name to remove"`
}

DropIn is the input contract for pulse_drop.

type DropOut

type DropOut struct {
	Handle  string `json:"handle" jsonschema:"The managed handle that was dropped"`
	Dropped bool   `json:"dropped" jsonschema:"True when the handle existed and was removed"`
}

DropOut is the output contract for pulse_drop.

func HandleDrop

func HandleDrop(ctx context.Context, p *pulse.Pulse, in DropIn) (DropOut, error)

HandleDrop runs pulse_drop: removes a managed import handle.

type ErrorsLookupIn

type ErrorsLookupIn struct {
	Code   string `json:"code,omitempty" jsonschema:"Exact error code identifier (e.g. 'PULSE_LOOKUP_MISS')"`
	Domain string `json:"domain,omitempty" jsonschema:"Domain prefix (PULSE, ENCODING, PROCESSING, SERVICE, DATA, CLI); case-insensitive"`
	Query  string `json:"query,omitempty" jsonschema:"Case-insensitive substring across descriptions and fixup hints"`
}

ErrorsLookupIn is the input contract for pulse_errors_lookup. At least one axis must be set; supplied axes are intersected.

type ErrorsLookupOut

type ErrorsLookupOut struct {
	Results []perr.LookupResult `json:"results" jsonschema:"Matching error-code metadata records"`
}

ErrorsLookupOut is the output contract for pulse_errors_lookup.

func HandleErrorsLookup

func HandleErrorsLookup(_ context.Context, p *pulse.Pulse, in ErrorsLookupIn) (ErrorsLookupOut, error)

HandleErrorsLookup runs pulse_errors_lookup. At least one axis must be set; supplied axes are intersected. It reads through the facade, so a feature-profiled instance answers with its own scoped view.

type ExamplesGetIn

type ExamplesGetIn struct {
	Name string `json:"name" jsonschema:"Example name from the _meta.name field (e.g. 't_test_one_sample')"`
}

ExamplesGetIn is the input contract for pulse_examples_get.

type ExamplesGetOut

type ExamplesGetOut = examples.Example

ExamplesGetOut is the output contract for pulse_examples_get.

func HandleExamplesGet

func HandleExamplesGet(_ context.Context, p *pulse.Pulse, in ExamplesGetIn) (ExamplesGetOut, error)

HandleExamplesGet runs pulse_examples_get: a single runnable example.

type ExamplesSearchIn

type ExamplesSearchIn struct {
	Query    string   `` /* 342-byte string literal not displayed */
	Tags     []string `json:"tags,omitempty" jsonschema:"Canonical taxonomy tags; results must carry every tag (AND)"`
	Category string   `` /* 185-byte string literal not displayed */
	Intent   string   `` /* 157-byte string literal not displayed */
}

ExamplesSearchIn is the input contract for pulse_examples_search. All four filters are optional and ANDed.

type ExamplesSearchOut

type ExamplesSearchOut struct {
	Results []examples.ExampleSummary `json:"results" jsonschema:"Matching example summaries (name, category, tags, operators, description)"`
}

ExamplesSearchOut is the output contract for pulse_examples_search.

func HandleExamplesSearch

func HandleExamplesSearch(_ context.Context, p *pulse.Pulse, in ExamplesSearchIn) (ExamplesSearchOut, error)

HandleExamplesSearch runs pulse_examples_search. All four filters are optional and ANDed; an unknown or hidden intent is the coded PULSE_RECOMMEND_INTENT_UNKNOWN.

type ExplainIn

type ExplainIn struct {
	Request          map[string]any `` /* 188-byte string literal not displayed */
	Composed         map[string]any `` /* 152-byte string literal not displayed */
	Chain            map[string]any `` /* 152-byte string literal not displayed */
	Facet            map[string]any `` /* 142-byte string literal not displayed */
	Sample           map[string]any `json:"sample,omitempty" jsonschema:"A pulse_sample request, described before it runs (never predicted)."`
	Response         map[string]any `` /* 135-byte string literal not displayed */
	ComposedResponse map[string]any `json:"composed_response,omitempty" jsonschema:"A pulse_compose result ({responses, overlays}) to read slot by slot."`
	ChainResponse    map[string]any `` /* 143-byte string literal not displayed */
	FacetResult      map[string]any `json:"facet_result,omitempty" jsonschema:"A pulse_facet result to read field by field."`
	Detail           string         `` /* 166-byte string literal not displayed */
}

ExplainIn is the input contract for pulse_explain: the roots of descriptor.ExplainRequest as open objects. A result root is decoded with the undefined-figure rule (a null figure stays undefined, never 0); a request root with plain encoding/json.

type ExplainOut

type ExplainOut = descriptor.ExplainResult

ExplainOut is the output contract for pulse_explain.

func HandleExplain

func HandleExplain(ctx context.Context, p *pulse.Pulse, in ExplainIn) (ExplainOut, error)

HandleExplain runs pulse_explain: each root the input sets is re-encoded and decoded into its typed slot — results through jsonfinite, so a figure the wire wrote as null (undefined) reads as NaN rather than as a real 0 — and pulse.Explain does the rest (root and detail validation included).

type FacetIn

type FacetIn struct {
	Path  string `json:"path" jsonschema:"Filesystem path to the .pulse file"`
	Field string `json:"field" jsonschema:"Field name to facet"`
}

FacetIn is the input contract for pulse_facet.

type FacetOut

type FacetOut struct {
	Values []string `json:"values" jsonschema:"Distinct values for the faceted field"`
}

FacetOut is the output contract for pulse_facet.

func HandleFacet

func HandleFacet(ctx context.Context, p *pulse.Pulse, in FacetIn) (FacetOut, error)

HandleFacet runs pulse_facet: distinct values for a single field.

type FacetSchemaIn

type FacetSchemaIn = types.FacetRequest

FacetSchemaIn is the input contract for pulse_facet_schema.

type FacetSchemaOut

type FacetSchemaOut = types.FacetResult

FacetSchemaOut is the output contract for pulse_facet_schema.

func HandleFacetSchema

func HandleFacetSchema(ctx context.Context, p *pulse.Pulse, in FacetSchemaIn) (FacetSchemaOut, error)

HandleFacetSchema runs pulse_facet_schema: the rich faceting endpoint.

type ImportIn

type ImportIn struct {
	Source    string `json:"source" jsonschema:"Filesystem path to the source file (relative to PULSE_DATA_DIR)"`
	Format    string `json:"format,omitempty" jsonschema:"Format override: csv, tsv, ndjson, jsonarray, parquet, arrow, excel, spss, pulse"`
	Handle    string `json:"handle,omitempty" jsonschema:"Managed handle name; defaults to source basename without extension"`
	TTL       string `` /* 127-byte string literal not displayed */
	Sheet     string `json:"sheet,omitempty" jsonschema:"Excel sheet name; ignored for non-Excel sources"`
	Charset   string `` /* 604-byte string literal not displayed */
	Overwrite bool   `json:"overwrite,omitempty" jsonschema:"Replace an existing handle of the same name. Default false."`
	// SourceTZ / ColumnSourceTZ / SourceTZField / DSTPolicy are io.ImportJob's
	// source-zone options, persisted onto the managed sidecar.
	SourceTZ       string            `` /* 433-byte string literal not displayed */
	ColumnSourceTZ map[string]string `` /* 233-byte string literal not displayed */
	SourceTZField  string            `` /* 584-byte string literal not displayed */
	DSTPolicy      string            `` /* 436-byte string literal not displayed */
	// Groups and SuggestGroups carry the parent-group surface. See the
	// slot-policy note below for why there is no ratio-floor or strict
	// slot beside them.
	Groups        []pio.GroupDecl `` /* 983-byte string literal not displayed */
	SuggestGroups bool            `` /* 544-byte string literal not displayed */
	// Vectors / VectorKinds are io.ImportJob.Vectors in the CLI's own
	// --vector / --vector-kind syntax, parsed by the same
	// io.ParseVectorDecl / io.ApplyVectorKinds.
	Vectors     []string `` /* 1291-byte string literal not displayed */
	VectorKinds []string `` /* 331-byte string literal not displayed */
	// Schema / IgnoreExtra / Float are io.ImportJob's explicit-schema and
	// float-width options, the CLI's --schema / --ignore-extra / --float.
	// None is persisted on the sidecar (see imports.Spec.Schema).
	Schema      []ImportSchemaField `` /* 897-byte string literal not displayed */
	IgnoreExtra bool                `` /* 314-byte string literal not displayed */
	Float       string              `` /* 288-byte string literal not displayed */
}

ImportIn is the input contract for pulse_import.

type ImportOut

type ImportOut = imports.Result

ImportOut is the output contract for pulse_import.

func HandleImport

func HandleImport(ctx context.Context, p *pulse.Pulse, in ImportIn) (ImportOut, error)

HandleImport runs pulse_import: converts a tabular source into a managed .pulse handle. On success the adapter fires schema-bind-on-inspect.

type ImportSchemaField

type ImportSchemaField struct {
	Name        string `` /* 143-byte string literal not displayed */
	Type        string `` /* 306-byte string literal not displayed */
	Nullable    bool   `` /* 151-byte string literal not displayed */
	Description string `json:"description,omitempty" jsonschema:"Field description stored in the cohort header (max 1000 bytes)."`
	Precision   uint8  `json:"precision,omitempty" jsonschema:"decimal128 only: total significant digits."`
	Scale       uint8  `json:"scale,omitempty" jsonschema:"decimal128 only: digits after the decimal point."`
	// Dim / Labels / Kind / ScaleMin / ScaleMax are the vector keys of
	// io.SchemaFileField (vec_f32 / vec_f64 only).
	Dim      int      `` /* 214-byte string literal not displayed */
	Labels   []string `` /* 190-byte string literal not displayed */
	Kind     string   `json:"kind,omitempty" jsonschema:"vec_f32 / vec_f64 only: measure, scale, composition or binary."`
	ScaleMin *float64 `json:"scale_min,omitempty" jsonschema:"vec_f32 / vec_f64 only: declared value-range lower bound; needs scale_max."`
	ScaleMax *float64 `json:"scale_max,omitempty" jsonschema:"vec_f32 / vec_f64 only: declared value-range upper bound; needs scale_min."`
}

ImportSchemaField is one entry of pulse_import's `schema` argument — the CLI --schema document's field shape (io.SchemaFileField), with nullable and description optional as they are in a schema file (absent = false / empty). HandleImport converts the entries and hands them to the CLI's own decoder, io.SchemaFromFields, so type names and layout resolve identically on both surfaces.

type ImportsListIn

type ImportsListIn struct{}

ImportsListIn is the (empty) input contract for pulse_imports_list.

type ImportsListOut

type ImportsListOut struct {
	Imports []imports.Entry `json:"imports" jsonschema:"Managed-import pool entries with sidecar metadata"`
}

ImportsListOut is the output contract for pulse_imports_list.

func HandleImportsList

func HandleImportsList(ctx context.Context, p *pulse.Pulse, _ ImportsListIn) (ImportsListOut, error)

HandleImportsList runs pulse_imports_list: managed-import pool snapshot.

type InspectIn

type InspectIn struct {
	Path string `json:"path" jsonschema:"Filesystem path to the .pulse file"`
	// Joins names the cohorts the session's requests will join. It
	// changes no inspect output: on a server binding tools on inspect,
	// the request-carrying tools widen their field enums with each
	// target's joined names (mcp.BindForInstanceWithJoins).
	Joins []InspectJoin `` /* 281-byte string literal not displayed */
}

InspectIn is the input contract for pulse_inspect.

type InspectJoin

type InspectJoin struct {
	Right string `json:"right" jsonschema:"Right-side cohort path, as in a request's joins[].right"`
	As    string `json:"as,omitempty" jsonschema:"The as prefix the request's join will carry (empty: none)"`
}

InspectJoin is one pulse_inspect join target — the right cohort path and the prefix the request's JoinSpec will carry.

type InspectOut

type InspectOut struct {
	descriptor.InspectResult
	Warnings []*descriptor.EnvelopeEntry `` /* 227-byte string literal not displayed */
}

InspectOut is the output contract for pulse_inspect: the inspect result with the header read's own DIAGNOSTICS beside it.

The result is EMBEDDED, so every key an agent already parses stays exactly where it was and `warnings` is purely additive. The slot exists because record_count is a DERIVED figure — payload bytes divided by the record stride — and a cohort whose payload is not a whole multiple of that stride reports the FLOOR. descriptor.Inspect raises an ENCODING_INVALID warning saying so; pulse.Inspect discards it, so routing this tool through that wrapper left an MCP agent unable to see a truncated tail at all. The CLI reads the same envelope (`pulse cohort inspect --json`), so the two surfaces now report the same thing.

Warnings is []*descriptor.EnvelopeEntry rather than []string on purpose: an agent that can read the code can look it up with pulse_errors_lookup, and the details map carries record_stride and trailing_bytes — the two numbers needed to act on it.

func HandleInspect

func HandleInspect(ctx context.Context, p *pulse.Pulse, in InspectIn) (InspectOut, error)

HandleInspect runs pulse_inspect: header-only schema introspection.

It reads through InspectEnvelope rather than Inspect because the envelope is where the WARNINGS are: a cohort whose payload length is not a whole multiple of the record stride reports the floored record_count with an ENCODING_INVALID warning beside it, and Inspect drops that warning on the floor. An agent holding only the result cannot tell a truncated tail from a clean read — see InspectOut.

The envelope-level fault arm mirrors Pulse.Inspect's exactly (a bad header comes back as env.Errors, not as a returned error), so the only behaviour that moved is the warnings slot.

type InvokeFunc

type InvokeFunc func(ctx context.Context, p *pulse.Pulse, raw json.RawMessage) (any, error)

InvokeFunc is the type-erased entry point for one tool: it strict-decodes raw arguments into the tool's typed In struct, calls the typed handler, and returns the typed Out as any. Coded errors from the facade (or the strict-decode layer) are returned verbatim — the adapter renders a *errors.CodedError as the structured {code, message, details} envelope.

type JoinTarget

type JoinTarget struct {
	Schema *encoding.Schema
	As     string
}

JoinTarget is one join target a bound schema widens its field enums with: the right cohort's schema and the `as` prefix the request's JoinSpec will carry ("" = none).

type LabelResolveIn

type LabelResolveIn struct {
	Table string `json:"table" jsonschema:"Label table name (from pulse_label_tables, e.g. 'brand')"`
	Query string `json:"query,omitempty" jsonschema:"Name to resolve, case-insensitive; empty returns the first rows (browse mode)"`
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum matches to return. Default 10."`
}

LabelResolveIn is the input contract for pulse_label_resolve.

type LabelResolveOut

type LabelResolveOut struct {
	Matches []pulse.LabelMatch `json:"matches" jsonschema:"Ranked (key, value, score) resolution candidates"`
}

LabelResolveOut is the output contract for pulse_label_resolve.

func HandleLabelResolve

func HandleLabelResolve(_ context.Context, p *pulse.Pulse, in LabelResolveIn) (LabelResolveOut, error)

HandleLabelResolve runs pulse_label_resolve: reverse-resolves a name to the raw categorical key(s) a filter / grouper expects.

type LabelTablesIn

type LabelTablesIn struct{}

LabelTablesIn is the (empty) input contract for pulse_label_tables.

type LabelTablesOut

type LabelTablesOut struct {
	Tables []pulse.LabelTableInfo `json:"tables" jsonschema:"Registered label tables (name, row count, enumerable flag)"`
}

LabelTablesOut is the output contract for pulse_label_tables.

func HandleLabelTables

func HandleLabelTables(_ context.Context, p *pulse.Pulse, _ LabelTablesIn) (LabelTablesOut, error)

HandleLabelTables runs pulse_label_tables: the INPUT-direction discovery companion to pulse_label_resolve.

type LookupIn

type LookupIn = types.LookupRequest

LookupIn is the input contract for pulse_lookup — the structured point- lookup request (cohort, key components, return columns, multiplicity) at top level.

type LookupOut

type LookupOut = types.LookupResult

LookupOut is the output contract for pulse_lookup — wraps the matched row(s) (Rows) plus any diagnostic Warnings.

func HandleLookup

func HandleLookup(ctx context.Context, p *pulse.Pulse, in LookupIn) (LookupOut, error)

HandleLookup runs pulse_lookup: resolves a point lookup (single-key or composite) against a cohort's prebuilt sidecar index. Delegates to Pulse.Lookup only; coded errors (PULSE_INDEX_MISSING, PULSE_INDEX_STALE, PULSE_INDEX_UNSUPPORTED_SHARDED, PULSE_LOOKUP_NOT_FOUND, PULSE_LOOKUP_AMBIGUOUS) surface verbatim.

type ManifestIn

type ManifestIn struct {
	Intent string `` /* 284-byte string literal not displayed */
}

ManifestIn is the input contract for pulse_manifest. With no intent it returns the full slim manifest.

type ManifestOut

type ManifestOut = descriptor.Manifest

ManifestOut is the output contract for pulse_manifest (the slim manifest is the same struct as the full one).

func HandleManifest

func HandleManifest(ctx context.Context, p *pulse.Pulse, in ManifestIn) (ManifestOut, error)

HandleManifest runs pulse_manifest: the slim bootstrap blob. Prose descriptions live in skills and are fetched via pulse_skills_get; duplicating them in the per-session bootstrap is the bloat --slim avoids. With an intent it is the slim form of p.ManifestForIntent; an unknown or hidden intent is the coded PULSE_RECOMMEND_INTENT_UNKNOWN.

type MaterializeIn

type MaterializeIn struct {
	Request   *types.Request `` /* 383-byte string literal not displayed */
	Out       string         `` /* 217-byte string literal not displayed */
	Overwrite bool           `` /* 240-byte string literal not displayed */
}

MaterializeIn is the input contract for pulse_materialize. The request is NESTED under `request` (a pulse_process body) rather than spread at the root, because out / overwrite are not request slots: spreading them would make a misspelled request slot indistinguishable from a tool argument. Strict mode (description quality) stays CLI + library only, as pulse_dedup's: it changes no byte written, and the warnings it would escalate are returned either way.

type MaterializeOut

type MaterializeOut = pulse.MaterializeResult

MaterializeOut is the output contract for pulse_materialize.

func HandleMaterialize

func HandleMaterialize(ctx context.Context, p *pulse.Pulse, in MaterializeIn) (MaterializeOut, error)

HandleMaterialize runs pulse_materialize: the request's derived columns written as ordinary fields of a new cohort at in.Out. All behaviour — the slot gate, every refusal, the atomic write — is pulse.Materialize; coded errors pass through verbatim.

type PredictIn

type PredictIn struct {
	types.Request
	Composed *types.ComposedRequest `` /* 175-byte string literal not displayed */
	Facet    *types.FacetRequest    `json:"facet,omitempty" jsonschema:"A pulse_facet_schema request to predict instead of a bare request. Alone at the root."`
	Chain    *types.ChainRequest    `` /* 205-byte string literal not displayed */
}

PredictIn is the input contract for pulse_predict: a bare types.Request at the root (the original contract, unchanged), or exactly ONE alternative root naming a different request shape. A root key beside an alternative, or two alternatives, is SERVICE_VALIDATION; an alternative whose capability the instance hides is an unknown key.

type PredictOut

type PredictOut struct {
	*descriptor.PredictResult
	Composed *pulse.ComposePredictResult `` /* 276-byte string literal not displayed */
	Facet    *pulse.FacetPredictResult   `` /* 130-byte string literal not displayed */
	Chain    *pulse.ChainPredictResult   `` /* 151-byte string literal not displayed */
	Errors   []*descriptor.EnvelopeEntry `` /* 182-byte string literal not displayed */
	Warnings []*descriptor.EnvelopeEntry `` /* 131-byte string literal not displayed */
}

PredictOut is the output contract for pulse_predict. A bare request answers with the PredictResult EMBEDDED, so its keys sit at the root byte-identically to the original contract; an alternative root answers under the same key it was sent under. Either way the coded errors / warnings that explain a `valid: false` verdict ride beside it (additive on the bare arm, #256; each omitted when empty).

func HandlePredict

func HandlePredict(ctx context.Context, p *pulse.Pulse, in PredictIn) (PredictOut, error)

HandlePredict runs pulse_predict: no-execute validation of a bare request, or of the one alternative root (composed / facet / chain) the decode accepted. A bare request's result keys sit at the root, an alternative root's verdict under its own key, each beside the coded errors and warnings behind it (a bare request's are the facade result's Errors / Warnings, #256); a returned error is the facade's own (a nil request or cohort, an unreadable cohort), passed through verbatim so its code survives.

type ProcessChainIn

type ProcessChainIn = types.ChainRequest

ProcessChainIn is the input contract for pulse_process_chain.

type ProcessChainOut

type ProcessChainOut = types.ChainResponse

ProcessChainOut is the output contract for pulse_process_chain.

func HandleProcessChain

func HandleProcessChain(ctx context.Context, p *pulse.Pulse, in ProcessChainIn) (ProcessChainOut, error)

HandleProcessChain runs pulse_process_chain: a source-rooted linear chain.

type ProcessIn

type ProcessIn = types.Request

ProcessIn is the input contract for pulse_process.

type ProcessOut

type ProcessOut = types.Response

ProcessOut is the output contract for pulse_process.

func HandleProcess

func HandleProcess(ctx context.Context, p *pulse.Pulse, in ProcessIn) (ProcessOut, error)

HandleProcess runs pulse_process: the buffered aggregation pipeline.

type RakeIn

type RakeIn struct {
	Cohort      string             `` /* 144-byte string literal not displayed */
	Out         string             `` /* 280-byte string literal not displayed */
	WeightField string             `` /* 267-byte string literal not displayed */
	Margins     []pulse.RakeMargin `` /* 576-byte string literal not displayed */
	By          string             `` /* 198-byte string literal not displayed */
	BaseWeight  string             `` /* 231-byte string literal not displayed */
	Missing     string             `` /* 223-byte string literal not displayed */
	MinWeight   float64            `` /* 144-byte string literal not displayed */
	MaxWeight   float64            `` /* 182-byte string literal not displayed */
	MaxIter     int                `` /* 152-byte string literal not displayed */
	Tol         float64            `` /* 145-byte string literal not displayed */
	Total       float64            `` /* 145-byte string literal not displayed */
	Overwrite   bool               `` /* 293-byte string literal not displayed */
}

RakeIn is the input contract for pulse_rake: a pulse.RakeRequest spread at the root (cohort, out and overwrite ARE request keys here, so nothing needs nesting). It declares the request's fields in the request's order and types, differing only in the schema descriptions, so HandleRake converts it with a plain type conversion — a field added to, removed from or retyped on pulse.RakeRequest without this mirror fails to compile. Every judgement on it is pulse.Rake's.

type RakeOut

type RakeOut = pulse.RakeResult

RakeOut is the output contract for pulse_rake.

func HandleRake

func HandleRake(ctx context.Context, p *pulse.Pulse, in RakeIn) (RakeOut, error)

HandleRake runs pulse_rake: survey weights computed for in.Cohort and written, beside every source column, into a new cohort at in.Out. All behaviour — every refusal (a missing cohort, out or margins included: PULSE_RAKE_INVALID), the solver, the atomic write — is pulse.Rake; coded errors pass through verbatim.

type RangeTablesIn

type RangeTablesIn struct{}

RangeTablesIn is the (empty) input contract for pulse_range_tables.

type RangeTablesOut

type RangeTablesOut struct {
	Tables []pulse.RangeTableInfo `json:"tables" jsonschema:"Registered range tables (name, range count, ordered labeled date ranges)"`
}

RangeTablesOut is the output contract for pulse_range_tables.

func HandleRangeTables

func HandleRangeTables(_ context.Context, p *pulse.Pulse, _ RangeTablesIn) (RangeTablesOut, error)

HandleRangeTables runs pulse_range_tables: the INPUT-direction discovery tool for named labeled-date-range sets consumed by GROUP_DATE_RANGES / FILTER_DATE_RANGES. Returns an empty list (never an error) when no range tables are registered.

type RecommendIn

type RecommendIn struct {
	Intent string   `` /* 182-byte string literal not displayed */
	Cohort string   `` /* 209-byte string literal not displayed */
	Fields []string `` /* 217-byte string literal not displayed */
	Level  string   `` /* 155-byte string literal not displayed */
	Limit  int      `` /* 161-byte string literal not displayed */
}

RecommendIn is the input contract for pulse_recommend. Cohort is a path (pulse_inspect's convention), lifted onto descriptor.RecommendRequest's cohort by the handler; every other slot is the request's own.

type RecommendOut

type RecommendOut = descriptor.RecommendResult

RecommendOut is the output contract for pulse_recommend.

func HandleRecommend

func HandleRecommend(ctx context.Context, p *pulse.Pulse, in RecommendIn) (RecommendOut, error)

HandleRecommend runs pulse_recommend: an intent becomes ranked draft requests, bound to a cohort's fields when one is given. All behaviour is pulse.Recommend: an empty intent is PULSE_RECOMMEND_INTENT_UNKNOWN, whose details.valid lists every ID — more use to an agent than a bare missing-argument error.

type SampleIn

type SampleIn struct {
	Path  string `json:"path" jsonschema:"Filesystem path to the .pulse file"`
	Count int    `json:"count,omitempty" jsonschema:"Maximum rows to return (default 10)"`
}

SampleIn is the input contract for pulse_sample.

type SampleOut

type SampleOut struct {
	Rows []map[string]any `json:"rows" jsonschema:"Sampled rows, each a field-name to value map"`
}

SampleOut is the output contract for pulse_sample.

func HandleSample

func HandleSample(ctx context.Context, p *pulse.Pulse, in SampleIn) (SampleOut, error)

HandleSample runs pulse_sample: returns up to Count rows (default 10).

type SkillsGetIn

type SkillsGetIn struct {
	Name string `json:"name" jsonschema:"Skill name (e.g. 'aggregation-design')"`
}

SkillsGetIn is the input contract for pulse_skills_get.

type SkillsGetOut

type SkillsGetOut struct {
	Body string `json:"body" jsonschema:"Markdown body of the named skill"`
}

SkillsGetOut is the output contract for pulse_skills_get.

func HandleSkillsGet

func HandleSkillsGet(_ context.Context, p *pulse.Pulse, in SkillsGetIn) (SkillsGetOut, error)

HandleSkillsGet runs pulse_skills_get: the markdown body of one skill. It reads the facade's p.Skill: a skill the instance prunes is "not found" exactly as a nonexistent one.

type SkillsListIn

type SkillsListIn struct {
	Intent string `` /* 274-byte string literal not displayed */
}

SkillsListIn is the input contract for pulse_skills_list. With no intent it lists every skill, sorted by name.

type SkillsListOut

type SkillsListOut struct {
	Skills []skills.Metadata `json:"skills" jsonschema:"Embedded skill-pack entries (name, description, applies_to)"`
}

SkillsListOut is the output contract for pulse_skills_list.

func HandleSkillsList

func HandleSkillsList(_ context.Context, p *pulse.Pulse, in SkillsListIn) (SkillsListOut, error)

HandleSkillsList runs pulse_skills_list: the embedded skill-pack index as the instance sees it — the facade's p.Skills(), unchanged when no intent is given. With an intent it is p.SkillsForIntent's ranked list; an unknown or hidden intent is the coded PULSE_RECOMMEND_INTENT_UNKNOWN.

type ToolDescriptor

type ToolDescriptor struct {
	Name         string
	Description  string
	InputSchema  json.RawMessage
	OutputSchema json.RawMessage
	Invoke       InvokeFunc
}

ToolDescriptor is the SDK-free, type-erased descriptor for one registered MCP tool. It pairs the reflected input/output JSON Schemas (json.RawMessage, so no consumer needs the schema reflector) with an Invoke closure that round-trips raw JSON arguments through the typed handler. The go-sdk adapter mounts these onto a server via the low-level Server.AddTool path.

func Tools

func Tools(cfg Config) []ToolDescriptor

Tools returns the full type-erased tool catalog in stable order (matching toolmeta.Names() and Schemas()). Each descriptor carries the reflected input/output schema (from the init-time registry) and a config-baked Invoke.

type ToolSchema

type ToolSchema struct {
	Name         string          `json:"name"`
	Description  string          `json:"description"`
	InputSchema  json.RawMessage `json:"input_schema"`
	OutputSchema json.RawMessage `json:"output_schema"`
}

ToolSchema is the reflected, SDK-free descriptor for one registered MCP tool: its name, description, and the input/output JSON Schemas (draft 2020-12) reflected from the typed In/Out contract structs. The schemas are carried as json.RawMessage so consumers — and the thin go-sdk adapter — never need to import the schema reflector or any MCP SDK.

func SchemaFor

func SchemaFor(name string) (ToolSchema, bool)

SchemaFor returns the reflected descriptor for the named tool.

func Schemas

func Schemas() []ToolSchema

Schemas returns the reflected descriptor for every registered tool in stable registration order (matching toolmeta.Names()).

Directories

Path Synopsis
Package toolmeta holds the metadata table for the MCP tools registered by the Pulse MCP layer.
Package toolmeta holds the metadata table for the MCP tools registered by the Pulse MCP layer.

Jump to

Keyboard shortcuts

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