mcp

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 13 Imported by: ? 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

Overview

Package mcp exposes a Verdict engine as MCP tools, so an agent can evaluate decisions, read a decision's rules, and check a model for gaps and overlaps without a human in the loop.

The catalogue is SDK-agnostic: a ToolDescriptor carries a name, reflected input and output schemas, and a type-erased Invoke. The go-sdk adapter in gosdk/ mounts them; anything else can too. Keeping the catalogue free of the SDK means the tool surface is testable without a transport.

Index

Constants

View Source
const (
	// SchemaResourceURI serves the VDJ JSON Schema. It is the same document
	// `verdict schema` prints and the documentation site publishes, so an agent
	// that reads it in-session and a human validating a file locally are held
	// to the same contract.
	SchemaResourceURI = URIScheme + "schema"

	// SkillResourceURI serves the embedded skill pack: how to drive Verdict,
	// written for a model rather than for a reader of the manual.
	SkillResourceURI = URIScheme + "skill"
)
View Source
const (
	DefaultServerName = "verdict"
	DefaultVersion    = "1.0.0"
)

Default server identity, used when a Config leaves them unset.

View Source
const URIScheme = "verdict://"

URIScheme is the URI scheme Verdict's MCP resources live under.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzeInput

type AnalyzeInput struct {
	ModelID string `json:"model_id" jsonschema:"the model to analyse"`
	Version string `json:"version,omitempty" jsonschema:"pin a model version; omit for the most recently loaded"`
}

AnalyzeInput selects a model to analyse.

type AnalyzeOutput

type AnalyzeOutput struct {
	Tables      []TableFinding `json:"tables" jsonschema:"one entry per decision table"`
	Diagnostics []string       `json:"diagnostics,omitempty" jsonschema:"the findings as human-readable lines"`
	Errors      int            `json:"error_count" jsonschema:"how many findings are error-severity"`
	Warnings    int            `json:"warning_count" jsonschema:"how many findings are warnings"`
}

AnalyzeOutput is the gap and overlap report.

func Analyze

Analyze implements verdict_analyze.

type Config

type Config struct {
	ServerName string
	Version    string
	// AllowLoad exposes the verdict_load tool, which registers a model sent by
	// the caller. Off by default: an agent that can load arbitrary models into
	// a shared engine can also shadow the ones an operator deployed.
	AllowLoad bool
}

Config carries the server-construction parameters for the tool catalogue.

type EvaluateDecisionInput

type EvaluateDecisionInput struct {
	ModelID      string         `json:"model_id" jsonschema:"the model to evaluate"`
	Version      string         `json:"version,omitempty" jsonschema:"pin a model version; omit for the most recently loaded"`
	DecisionID   string         `json:"decision_id,omitempty" jsonschema:"the decision to evaluate, by id or name; supply this or service_id"`
	ServiceID    string         `json:"service_id,omitempty" jsonschema:"the decision service to evaluate, by id or name; supply this or decision_id"`
	Inputs       map[string]any `json:"inputs" jsonschema:"the model's input-data values, keyed by input name"`
	IncludeTrace bool           `json:"include_trace,omitempty" jsonschema:"return the full execution trace as well as the outputs"`
}

EvaluateDecisionInput evaluates one decision or service.

type EvaluateInput

type EvaluateInput struct {
	ModelID      string         `json:"model_id" jsonschema:"the model to evaluate; use verdict_list_models to discover it"`
	Version      string         `json:"version,omitempty" jsonschema:"pin a model version; omit for the most recently loaded"`
	Inputs       map[string]any `json:"inputs" jsonschema:"the model's input-data values, keyed by input name; verdict_explain lists them"`
	IncludeTrace bool           `json:"include_trace,omitempty" jsonschema:"return the full execution trace as well as the outputs"`
}

EvaluateInput evaluates a model's top-level decisions.

type EvaluateOutput

type EvaluateOutput struct {
	Outputs     map[string]any `json:"outputs" jsonschema:"the evaluated decisions' values, keyed by decision output name"`
	Summary     []string       `json:"summary" jsonschema:"one line per decision that fired, in evaluation order"`
	Diagnostics []string       `json:"diagnostics,omitempty" jsonschema:"warnings and errors reported during this evaluation"`
	Trace       any            `json:"trace,omitempty" jsonschema:"the full execution trace, present when include_trace was set"`
	DurationMS  int64          `json:"duration_ms" jsonschema:"wall time of the evaluation in milliseconds"`
}

EvaluateOutput is the result of an evaluation.

func Evaluate

Evaluate implements verdict_evaluate.

func EvaluateDecision

func EvaluateDecision(ctx context.Context, e *verdict.Engine, in EvaluateDecisionInput) (EvaluateOutput, error)

EvaluateDecision implements verdict_evaluate_decision.

type ExplainInput

type ExplainInput struct {
	ModelID    string `json:"model_id" jsonschema:"the model to describe"`
	Version    string `json:"version,omitempty" jsonschema:"pin a model version; omit for the most recently loaded"`
	DecisionID string `json:"decision_id,omitempty" jsonschema:"the decision to describe; omit to list the model's decisions and services"`
}

ExplainInput selects what to explain.

type ExplainOutput

type ExplainOutput struct {
	Text  string `json:"text" jsonschema:"the explanation as prose: read this first"`
	Slice any    `json:"slice,omitempty" jsonschema:"the same explanation as structured data"`
}

ExplainOutput is a decision's description.

func Explain

Explain implements verdict_explain.

type ListInput

type ListInput struct{}

ListInput selects nothing; the engine lists everything it has.

type ListOutput

type ListOutput struct {
	Models []ModelSummary `json:"models" jsonschema:"the decision models this engine has loaded"`
}

ListOutput is the model index.

func ListModels

func ListModels(_ context.Context, e *verdict.Engine, _ ListInput) (ListOutput, error)

ListModels implements verdict_list_models.

type LoadInput

type LoadInput struct {
	Source string `json:"source" jsonschema:"the model document: DMN 1.5 XML or Verdict Decision JSON"`
}

LoadInput registers a model.

type LoadOutput

type LoadOutput struct {
	Model       ModelSummary `json:"model" jsonschema:"the registered model"`
	Diagnostics []string     `json:"diagnostics,omitempty" jsonschema:"findings from parsing and static analysis"`
}

LoadOutput reports what was registered.

func LoadModel

func LoadModel(_ context.Context, e *verdict.Engine, in LoadInput) (LoadOutput, error)

LoadModel implements verdict_load_model.

type ModelSummary

type ModelSummary struct {
	ID        string   `json:"id" jsonschema:"the model identifier to pass as model_id"`
	Name      string   `json:"name,omitempty" jsonschema:"the model's human-readable name"`
	Version   string   `json:"version,omitempty" jsonschema:"the model version, empty when unversioned"`
	Decisions []string `json:"decisions" jsonschema:"every decision this model defines"`
	TopLevel  []string `json:"top_level_decisions" jsonschema:"the decisions nothing else depends on: the model's outputs"`
	Services  []string `json:"services,omitempty" jsonschema:"the decision services this model exposes"`
	Inputs    []string `json:"inputs" jsonschema:"the input-data names a caller must supply"`
	Errors    int      `json:"error_count" jsonschema:"how many error-severity diagnostics this model reported at load"`
	Warnings  int      `json:"warning_count" jsonschema:"how many warnings this model reported at load"`
}

ModelSummary describes one loaded model.

type ResourceDescriptor

type ResourceDescriptor struct {
	URI         string
	Name        string
	Description string
	MIMEType    string
	Read        func(ctx context.Context) ([]byte, error)
}

ResourceDescriptor describes one MCP resource, independent of transport and SDK, exactly as ToolDescriptor does for tools. Read returns the body.

func Resource

func Resource(uri string) (ResourceDescriptor, error)

Resource returns the descriptor for a URI.

func Resources

func Resources() []ResourceDescriptor

Resources returns the resource catalogue.

Both entries are static and model-independent: they describe the format and the engine, not any loaded model, so they are safe to expose regardless of what the server has been given to evaluate.

type TableFinding

type TableFinding struct {
	Decision    string   `json:"decision" jsonschema:"the decision this table belongs to"`
	HitPolicy   string   `json:"hit_policy" jsonschema:"the table's hit policy in shorthand: U, A, P, F, C, C+, C<, C>, C#, R or O"`
	Rules       int      `json:"rules" jsonschema:"how many rules the table has"`
	Analysable  bool     `json:"analysable" jsonschema:"false when the table's inputs have no enumerable domain"`
	Reason      string   `json:"reason,omitempty" jsonschema:"why the table could not be analysed"`
	Gaps        []string `json:"gaps,omitempty" jsonschema:"input combinations no rule covers"`
	Overlaps    []string `json:"overlaps,omitempty" jsonschema:"input combinations several rules cover"`
	Unreachable []string `json:"unreachable_rules,omitempty" jsonschema:"rules an earlier rule makes unreachable"`
}

TableFinding is one decision table's analysis.

type ToolDescriptor

type ToolDescriptor struct {
	Name         string
	Description  string
	InputSchema  json.RawMessage
	OutputSchema json.RawMessage
	Invoke       func(ctx context.Context, e *verdict.Engine, raw json.RawMessage) (any, error)
}

ToolDescriptor describes one Verdict MCP tool, independent of transport and SDK. Invoke is type-erased: it unmarshals raw JSON arguments into the tool's typed input, calls the typed handler, and returns the typed output.

func Tools

func Tools(cfg Config) []ToolDescriptor

Tools returns the catalogue.

Directories

Path Synopsis
Package gosdk mounts Verdict's MCP tool catalogue onto the official modelcontextprotocol/go-sdk server.
Package gosdk mounts Verdict's MCP tool catalogue onto the official modelcontextprotocol/go-sdk server.

Jump to

Keyboard shortcuts

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