tools

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const ServerInstructions = "" /* 483-byte string literal not displayed */

ServerInstructions is the concise decision rule surfaced during MCP initialize so clients can discover the focused context workflow.

Variables

This section is empty.

Functions

func NewProductionServer added in v1.1.0

func NewProductionServer(implementation *mcp.Implementation) *mcp.Server

NewProductionServer creates the configured MCP server used by the binary.

func RegisterAll

func RegisterAll(server *mcp.Server, runtime *Runtime)

RegisterAll is the single deterministic protocol registration list.

func RegisterAuditConcurrency

func RegisterAuditConcurrency(server *mcp.Server, runtime *Runtime)

RegisterAuditConcurrency registers the concurrency audit tool.

func RegisterAuditErrors

func RegisterAuditErrors(server *mcp.Server, runtime *Runtime)

RegisterAuditErrors registers the error audit tool.

func RegisterBenchmarkDiff

func RegisterBenchmarkDiff(server *mcp.Server, runtime *Runtime)

RegisterBenchmarkDiff registers go_benchmark_diff with execution hints.

func RegisterChangeTools

func RegisterChangeTools(server *mcp.Server, runtime *Runtime)

RegisterChangeTools registers private Change Contract continuity operations.

func RegisterContext added in v1.1.0

func RegisterContext(server *mcp.Server, runtime *Runtime)

RegisterContext adds the post-v1 focus tool after the frozen registry.

func RegisterCoverageGaps

func RegisterCoverageGaps(server *mcp.Server, runtime *Runtime)

RegisterCoverageGaps registers go_coverage_gaps with execution hints.

func RegisterFlakeFinder

func RegisterFlakeFinder(server *mcp.Server, runtime *Runtime)

RegisterFlakeFinder registers go_flake_finder with execution hints.

func RegisterIntelligenceResources

func RegisterIntelligenceResources(server *mcp.Server, runtime *Runtime)

RegisterIntelligenceResources publishes effective semantic capabilities and snapshot-bound Context Pack detail artifacts.

func RegisterProduction added in v1.1.0

func RegisterProduction(server *mcp.Server, runtime *Runtime)

RegisterProduction installs the complete current production surface. The frozen RegisterAll inventory remains separate so post-v1 tools stay additive.

func RegisterPrompts

func RegisterPrompts(server *mcp.Server)

RegisterPrompts registers the six workflow prompts.

func RegisterRaceReport

func RegisterRaceReport(server *mcp.Server, runtime *Runtime)

RegisterRaceReport registers go_race_report with truthful execution hints.

func RegisterRefactor

func RegisterRefactor(server *mcp.Server, runtime *Runtime)

RegisterRefactor registers guarded preview and apply through one plan-bound operation. Static annotations describe the apply-capable trust boundary.

func RegisterResources

func RegisterResources(server *mcp.Server, runtime *Runtime)

RegisterResources registers the complete fixed and templated resource inventory.

func RegisterSearch

func RegisterSearch(server *mcp.Server, runtime *Runtime)

RegisterSearch registers the workspace-symbol search adapter.

func RegisterSymbolContext

func RegisterSymbolContext(server *mcp.Server, runtime *Runtime)

RegisterSymbolContext registers the symbol-context adapter.

func RegisterTestStructured

func RegisterTestStructured(server *mcp.Server, runtime *Runtime)

RegisterTestStructured registers go_test_structured with truthful hints.

func RegisterVerifyChange

func RegisterVerifyChange(server *mcp.Server, runtime *Runtime)

RegisterVerifyChange registers the approval-gated verification adapter.

func RegisterWorkspaceBrief

func RegisterWorkspaceBrief(server *mcp.Server, runtime *Runtime)

RegisterWorkspaceBrief registers the compact workspace brief adapter.

func RegisterWorkspaceResources

func RegisterWorkspaceResources(server *mcp.Server, runtime *Runtime)

RegisterWorkspaceResources registers the v0.1 workspace context resources.

Types

type AuditConcurrencyInput

type AuditConcurrencyInput struct {
	Package     string           `json:"package" jsonschema:"Go package import path or ./relative/path"`
	MinSeverity finding.Severity `json:"min_severity,omitempty" jsonschema:"lowest severity to include; default info"`
	MaxFindings int              `json:"max_findings,omitempty" jsonschema:"maximum findings to return; default 200, maximum 1000"`
}

AuditConcurrencyInput configures the concurrency audit.

type AuditConcurrencyOutput

type AuditConcurrencyOutput struct {
	Result finding.AuditResult `json:"result"`
}

AuditConcurrencyOutput is the structured concurrency audit result.

type AuditErrorsInput

type AuditErrorsInput struct {
	Package     string           `json:"package" jsonschema:"Go package import path or ./relative/path"`
	MinSeverity finding.Severity `json:"min_severity,omitempty" jsonschema:"lowest severity to include; default info"`
	MaxFindings int              `json:"max_findings,omitempty" jsonschema:"maximum findings to return; default 200, maximum 1000"`
}

AuditErrorsInput configures the error audit.

type AuditErrorsOutput

type AuditErrorsOutput struct {
	Result finding.AuditResult `json:"result"`
}

AuditErrorsOutput is the structured error audit result.

type BeginChangeInput

type BeginChangeInput struct {
	Base            string                          `json:"base" jsonschema:"required local base ref"`
	Goal            string                          `json:"goal" jsonschema:"required human-written change goal"`
	Package         string                          `json:"package,omitempty"`
	FocusedPaths    []string                        `json:"focused_paths,omitempty"`
	FocusedPackages []string                        `json:"focused_packages,omitempty"`
	FocusedSymbols  []string                        `json:"focused_symbols,omitempty"`
	AllowedPaths    []string                        `json:"allowed_paths,omitempty"`
	Policies        intelligence.StructuralPolicies `json:"policies,omitempty"`
}

BeginChangeInput selects the initial private Change Contract boundary.

type BenchmarkComparison

type BenchmarkComparison struct {
	Name         string  `json:"name"`
	BaselineNsOp float64 `json:"baseline_ns_op"`
	CurrentNsOp  float64 `json:"current_ns_op"`
	DeltaPercent float64 `json:"delta_percent"`
	Regression   bool    `json:"regression"`
}

BenchmarkComparison compares one benchmark across revisions.

type BenchmarkDiffInput

type BenchmarkDiffInput struct {
	Package          string   `json:"package" jsonschema:"Go package import path or ./relative/path"`
	Baseline         string   `json:"baseline" jsonschema:"git ref to compare against, e.g. HEAD~1 or main"`
	BenchRegex       string   `json:"bench_regex,omitempty" jsonschema:"regex filter for -bench; default all benchmarks"`
	Count            int      `json:"count,omitempty" jsonschema:"repetitions per revision; default 6, maximum 20"`
	ThresholdPercent *float64 `json:"threshold_percent,omitempty" jsonschema:"regression threshold percent; default 10"`
}

BenchmarkDiffInput configures a current-versus-baseline benchmark run.

type BenchmarkDiffOutput

type BenchmarkDiffOutput struct {
	Comparisons []BenchmarkComparison `json:"comparisons"`
	Regressions int                   `json:"regressions"`
}

BenchmarkDiffOutput contains deterministic benchmark comparisons.

type CheckpointChangeInput

type CheckpointChangeInput struct {
	ContractID          string   `json:"contract_id" jsonschema:"required"`
	ExpectedSnapshotID  string   `json:"expected_snapshot_id" jsonschema:"required"`
	Decisions           []string `json:"decisions,omitempty"`
	UnresolvedQuestions []string `json:"unresolved_questions,omitempty"`
}

CheckpointChangeInput selects one exact Change Contract lineage transition.

type ContextInput added in v1.1.0

type ContextInput struct {
	Base               string   `json:"base" jsonschema:"local commit or ref to compare with HEAD and the final worktree"`
	Package            string   `json:"package,omitempty" jsonschema:"Go package scope; default ./..."`
	ExpectedSnapshotID string   `json:"expected_snapshot_id,omitempty" jsonschema:"reject unless this snapshot is current"`
	FailOn             string   `json:"fail_on,omitempty" jsonschema:"verification severity policy: error, warning, info, or none"`
	MinChangedCoverage *float64 `json:"min_changed_coverage,omitempty" jsonschema:"verification coverage policy from 0 through 100"`
	MaxPackages        int      `json:"max_packages,omitempty" jsonschema:"maximum affected package closure; default 200"`
	Race               bool     `json:"race,omitempty" jsonschema:"require race evidence for applicability"`
	Query              string   `` /* 151-byte string literal not displayed */
	SymbolRef          string   `` /* 126-byte string literal not displayed */
	File               string   `` /* 141-byte string literal not displayed */
	Line               int      `json:"line,omitempty" jsonschema:"source-position selector line; use with file and column"`
	Column             int      `json:"column,omitempty" jsonschema:"source-position selector one-based UTF-8 byte column; use with file and line"`
	MaxBytes           int      `json:"max_bytes,omitempty" jsonschema:"focused evidence budget; default 8192"`
	PreviousPackID     string   `` /* 156-byte string literal not displayed */
	FocusFile          string   `json:"focus_file,omitempty" jsonschema:"one mutually exclusive active Go file selector; start with one selector"`
	FocusPackage       string   `json:"focus_package,omitempty" jsonschema:"one mutually exclusive active Go package selector; start with one selector"`
}

ContextInput is the additive go_context MCP input contract.

type CoverageGap

type CoverageGap struct {
	File       string `json:"file"`
	StartLine  int    `json:"start_line"`
	StartCol   int    `json:"start_col"`
	EndLine    int    `json:"end_line"`
	EndCol     int    `json:"end_col"`
	Statements int    `json:"statements"`
}

CoverageGap is one uncovered source range.

type CoverageGapsInput

type CoverageGapsInput struct {
	Package string `json:"package" jsonschema:"Go package import path or ./relative/path"`
}

CoverageGapsInput selects packages for one bounded coverage run.

type CoverageGapsOutput

type CoverageGapsOutput struct {
	Files          []FileCoverage `json:"files"`
	OverallPercent float64        `json:"overall_percent"`
}

CoverageGapsOutput is a statement-weighted coverage report.

type FileCoverage

type FileCoverage struct {
	File    string        `json:"file"`
	Percent float64       `json:"percent"`
	Gaps    []CoverageGap `json:"gaps"`
}

FileCoverage contains statement coverage and gaps for one source file.

type FlakeFinderInput

type FlakeFinderInput struct {
	Package        string `json:"package" jsonschema:"Go package import path or ./relative/path"`
	Runs           int    `json:"runs,omitempty" jsonschema:"repetitions; default 20, maximum 200"`
	TimeoutSeconds int    `json:"timeout_seconds,omitempty" jsonschema:"test timeout in seconds; default 120, maximum 300"`
}

FlakeFinderInput configures repeated tests in one bounded subprocess.

type FlakeFinderOutput

type FlakeFinderOutput struct {
	Flaky         []FlakeResult `json:"flaky"`
	TotalTestsRun int           `json:"total_tests_run"`
}

FlakeFinderOutput contains only observed flakes and the sampled test count.

type FlakeResult

type FlakeResult struct {
	Test      string  `json:"test"`
	Package   string  `json:"package"`
	Runs      int     `json:"runs"`
	Passes    int     `json:"passes"`
	Failures  int     `json:"failures"`
	FlakeRate float64 `json:"flake_rate"`
}

FlakeResult is one test observed both passing and failing.

type PackageSummary

type PackageSummary struct {
	Status  string `json:"status"`
	Passed  int    `json:"passed"`
	Failed  int    `json:"failed"`
	Skipped int    `json:"skipped"`
	Output  string `json:"output,omitempty"`
}

PackageSummary aggregates test results for one package.

type RaceReportInput

type RaceReportInput struct {
	Package        string `json:"package" jsonschema:"Go package import path or ./relative/path"`
	TimeoutSeconds int    `json:"timeout_seconds,omitempty" jsonschema:"test timeout in seconds; default 60, maximum 300"`
}

RaceReportInput configures one bounded race-detector run.

type RaceReportOutput

type RaceReportOutput struct {
	Conflicts      []parser.RaceConflict `json:"conflicts"`
	RawBlocksFound int                   `json:"raw_blocks_found"`
}

RaceReportOutput contains every race detector block recovered from a run.

type RefactorInput

type RefactorInput struct {
	Operation          string   `json:"operation,omitempty" jsonschema:"preview operation: rename, format, organize_imports, or fix_all"`
	SymbolRef          string   `json:"symbol_ref,omitempty" jsonschema:"snapshot-bound symbol reference required for rename preview"`
	NewName            string   `json:"new_name,omitempty" jsonschema:"new Go identifier required for rename preview"`
	Files              []string `json:"files,omitempty" jsonschema:"existing workspace-relative files for formatting or allowed fix actions"`
	PlanID             string   `json:"plan_id,omitempty" jsonschema:"content-addressed preview plan required for apply"`
	ExpectedSnapshotID string   `json:"expected_snapshot_id" jsonschema:"required exact snapshot used for preview or apply"`
	Apply              bool     `json:"apply,omitempty" jsonschema:"apply the exact stored plan after explicit client approval"`
}

RefactorInput previews or explicitly applies one guarded refactor plan.

type Runtime

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

Runtime owns the shared, process-wide dependencies used by MCP tools.

func NewRuntime

func NewRuntime(ws *workspace.Workspace, runner *execution.Runner, tracer *trace.Tracer) (*Runtime, error)

NewRuntime validates the dependencies shared by every tool registration.

func NewRuntimeWithIntelligence

func NewRuntimeWithIntelligence(ws *workspace.Workspace, runner *execution.Runner, tracer *trace.Tracer, providerVersion string, service IntelligenceService) (*Runtime, error)

NewRuntimeWithIntelligence preserves the existing runtime constructor while allowing the semantic MCP adapters to be installed by newer binaries.

func NewRuntimeWithVersion

func NewRuntimeWithVersion(ws *workspace.Workspace, runner *execution.Runner, tracer *trace.Tracer, providerVersion string) (*Runtime, error)

NewRuntimeWithVersion preserves the producing binary version in portable verification reports while retaining NewRuntime for internal callers.

type SearchInput

type SearchInput struct {
	Query              string `json:"query" jsonschema:"workspace symbol query"`
	Package            string `json:"package,omitempty" jsonschema:"optional Go package scope"`
	Cursor             string `json:"cursor,omitempty" jsonschema:"snapshot-bound continuation cursor"`
	ExpectedSnapshotID string `json:"expected_snapshot_id,omitempty" jsonschema:"reject the request unless this snapshot is still current"`
	Limit              int    `json:"limit,omitempty" jsonschema:"maximum 100; default 20"`
}

SearchInput selects a page of workspace symbols.

type SymbolContextInput

type SymbolContextInput struct {
	SymbolRef          string `json:"symbol_ref,omitempty" jsonschema:"opaque snapshot-bound symbol reference"`
	File               string `json:"file,omitempty" jsonschema:"workspace-relative Go file"`
	ExpectedSnapshotID string `json:"expected_snapshot_id,omitempty" jsonschema:"reject the request unless this snapshot is still current"`
	Line               int    `json:"line,omitempty" jsonschema:"one-based source line"`
	Column             int    `json:"column,omitempty" jsonschema:"one-based UTF-8 byte column"`
	MaxBytes           int    `json:"max_bytes,omitempty" jsonschema:"optional response budget; default 16384"`
	CallHierarchy      bool   `json:"call_hierarchy,omitempty"`
	TypeDefinition     bool   `json:"type_definition,omitempty"`
}

SymbolContextInput selects a symbol by opaque reference or source position.

type TestCase

type TestCase struct {
	Name     string  `json:"name"`
	Package  string  `json:"package"`
	Status   string  `json:"status"`
	ElapsedS float64 `json:"elapsed_s"`
	Output   string  `json:"output,omitempty"`
}

TestCase is one terminal test result.

type TestStructuredInput

type TestStructuredInput struct {
	Package        string `json:"package" jsonschema:"Go package import path or ./relative/path"`
	Race           bool   `json:"race,omitempty" jsonschema:"enable the race detector; default false"`
	Verbose        bool   `json:"verbose,omitempty" jsonschema:"include passing and skipped test output; default false"`
	TimeoutSeconds int    `json:"timeout_seconds,omitempty" jsonschema:"test timeout in seconds; default 60, maximum 300"`
}

TestStructuredInput configures one bounded go test -json run.

type TestStructuredOutput

type TestStructuredOutput struct {
	Packages   map[string]PackageSummary `json:"packages"`
	Tests      []TestCase                `json:"tests"`
	Passed     int                       `json:"passed"`
	Failed     int                       `json:"failed"`
	Skipped    int                       `json:"skipped"`
	DurationMS int64                     `json:"duration_ms"`
}

TestStructuredOutput is the structured result of a go test invocation.

type VerifyChangeInput

type VerifyChangeInput struct {
	Base               string              `json:"base" jsonschema:"required local commit or ref compared with HEAD and the final worktree"`
	Package            string              `json:"package,omitempty" jsonschema:"Go package scope; default ./..."`
	Race               bool                `json:"race,omitempty" jsonschema:"include race detection; default false"`
	FailOn             verification.FailOn `json:"fail_on,omitempty" jsonschema:"blocking analyzer severity: error, warning, info, or none; default error"`
	MinChangedCoverage *float64            `json:"min_changed_coverage,omitempty" jsonschema:"optional changed-statement coverage minimum from 0 through 100"`
	MaxPackages        int                 `json:"max_packages,omitempty" jsonschema:"maximum affected package closure; default 200, maximum 500"`
	ContractID         string              `json:"contract_id,omitempty" jsonschema:"optional private Change Contract evaluated against the exact verification snapshot"`
	ExpectedSnapshotID string              `json:"expected_snapshot_id,omitempty" jsonschema:"optional exact semantic snapshot required for this verification"`
}

VerifyChangeInput configures one complete change-verification report.

type WorkspaceBriefInput

type WorkspaceBriefInput struct {
	Base               string `json:"base,omitempty" jsonschema:"optional local base ref for change context"`
	Package            string `json:"package,omitempty" jsonschema:"optional Go package scope; default ./..."`
	ExpectedSnapshotID string `json:"expected_snapshot_id,omitempty" jsonschema:"reject the request unless this snapshot is still current"`
	MaxBytes           int    `json:"max_bytes,omitempty" jsonschema:"optional response budget; default 8192"`
}

WorkspaceBriefInput selects the compact, source-grounded workspace overview.

Jump to

Keyboard shortcuts

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