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 ¶
- func Bind(schema *encoding.Schema) (map[string]json.RawMessage, error)
- func BindWithExtensions(schema *encoding.Schema, snap *descriptor.ExtensionsSnapshot) (map[string]json.RawMessage, error)
- type ComposeIn
- type ComposeOut
- type Config
- type DropIn
- type DropOut
- type ErrorsLookupIn
- type ErrorsLookupOut
- type ExamplesGetIn
- type ExamplesGetOut
- type ExamplesSearchIn
- type ExamplesSearchOut
- type FacetIn
- type FacetOut
- type FacetSchemaIn
- type FacetSchemaOut
- type ImportIn
- type ImportOut
- type ImportsListIn
- type ImportsListOut
- type InspectIn
- type InspectOut
- type InvokeFunc
- type LabelResolveIn
- type LabelResolveOut
- type LabelTablesIn
- type LabelTablesOut
- type ManifestIn
- type ManifestOut
- type PredictIn
- type PredictOut
- type ProcessChainIn
- type ProcessChainOut
- type ProcessIn
- type ProcessOut
- type SampleIn
- type SampleOut
- type SkillsGetIn
- type SkillsGetOut
- type SkillsListIn
- type SkillsListOut
- type ToolDescriptor
- type ToolSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind returns per-tool JSON Schemas keyed by tool name with no embedder extensions applied. Equivalent to BindWithExtensions with a nil snapshot.
func BindWithExtensions ¶
func BindWithExtensions(schema *encoding.Schema, snap *descriptor.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.
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 ¶
HandleCompose runs pulse_compose: multi-request batch + overlay fold.
type Config ¶
type Config struct {
Version string
}
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.
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.
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, _ *pulse.Pulse, in ErrorsLookupIn) (ErrorsLookupOut, error)
HandleErrorsLookup runs pulse_errors_lookup. At least one axis must be set; supplied axes are intersected.
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 ¶
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 `json:"query,omitempty" jsonschema:"Case-insensitive substring matched against name, description, and operators"`
Tags []string `json:"tags,omitempty" jsonschema:"Canonical taxonomy tags; results must carry every tag (AND)"`
Category string `` /* 139-byte string literal not displayed */
}
ExamplesSearchIn is the input contract for pulse_examples_search. All three 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 three filters are optional and ANDed.
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.
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, 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"`
Overwrite bool `json:"overwrite,omitempty" jsonschema:"Replace an existing handle of the same name. Default false."`
}
ImportIn is the input contract for pulse_import.
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"`
}
InspectIn is the input contract for pulse_inspect.
type InspectOut ¶
type InspectOut = descriptor.InspectResult
InspectOut is the output contract for pulse_inspect.
func HandleInspect ¶
HandleInspect runs pulse_inspect: header-only schema introspection.
type InvokeFunc ¶
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 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 ManifestIn ¶
type ManifestIn struct{}
ManifestIn is the (empty) input contract for pulse_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, _ 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.
type PredictOut ¶
type PredictOut = descriptor.PredictResult
PredictOut is the output contract for pulse_predict.
func HandlePredict ¶
HandlePredict runs pulse_predict: no-execute request validation.
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 ProcessOut ¶
ProcessOut is the output contract for pulse_process.
func HandleProcess ¶
HandleProcess runs pulse_process: the buffered aggregation pipeline.
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.
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, _ *pulse.Pulse, in SkillsGetIn) (SkillsGetOut, error)
HandleSkillsGet runs pulse_skills_get: the markdown body of one skill.
type SkillsListIn ¶
type SkillsListIn struct{}
SkillsListIn is the (empty) input contract for pulse_skills_list.
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, _ *pulse.Pulse, _ SkillsListIn) (SkillsListOut, error)
HandleSkillsList runs pulse_skills_list: the embedded skill-pack index.
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 gosdk is the thin, reusable adapter that mounts the SDK-free Pulse MCP catalog (github.com/frankbardon/pulse/mcp) onto a caller-supplied github.com/modelcontextprotocol/go-sdk server.
|
Package gosdk is the thin, reusable adapter that mounts the SDK-free Pulse MCP catalog (github.com/frankbardon/pulse/mcp) onto a caller-supplied github.com/modelcontextprotocol/go-sdk server. |
|
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. |