Documentation
¶
Index ¶
- Variables
- func NewFreshnessCoordinator(ctx context.Context, roots []string, registry *parserapi.Registry, ...) (*FreshnessCoordinator, *FreshnessGeneration, error)
- type CatalogInput
- type DataResourceInput
- type DataResourceUsageInput
- type EndpointInput
- type FailureFlowInput
- type FailureFlowOutput
- type FindReusableCodeInput
- type FindSymbolsInput
- type FindSymbolsOutput
- type FreshnessCoordinator
- type FreshnessCoordinatorOptions
- type FreshnessDiagnostics
- type FreshnessGeneration
- type GodotCompositionInput
- type GodotCompositionOutput
- type GodotInteractionsInput
- type GodotInteractionsOutput
- type HandlerInput
- type ImpactInput
- type ImpactOutput
- type MessageCoverageInput
- type MessageFlowInput
- type MessageFlowOutput
- type NodeOutput
- type PathInput
- type PathOutput
- type PathPair
- type ResultEnvelope
- type ReusableSearch
- type SearchSourceInput
- type SelectorInput
- type Service
- func (s *Service) Run(ctx context.Context, version string) error
- func (s *Service) Server(version string) *mcp.Server
- func (s *Service) WithFreshness(coordinator *FreshnessCoordinator) *Service
- func (s *Service) WithRefresh(refresh func(context.Context) error) *Service
- func (s *Service) WithReusable(search ReusableSearch) *Service
- func (s *Service) WithReusableFactory(factory func(graph.ReadRepository, []indexer.Project) ReusableSearch) *Service
- func (s *Service) WithSearch(service *search.Service) *Service
- func (s *Service) WithSearchFactory(factory func(graph.ReadRepository, []indexer.Project) (*search.Service, error)) *Service
- func (s *Service) WithSource(...) *Service
- func (s *Service) WithSourceFactory(factory func(graph.ReadRepository, []indexer.Project) (...)) *Service
- type ServiceTopologyInput
- type SourceInput
- type SourceOutput
- type StatusInput
- type StatusOutput
- type TestCoverageInput
- type TestCoverageOutput
- type TraversalInput
- type TraversalOutput
Constants ¶
This section is empty.
Variables ¶
var ErrContinuouslyChangingSource = errors.New("source changed during all freshness refresh attempts")
Functions ¶
func NewFreshnessCoordinator ¶
func NewFreshnessCoordinator(ctx context.Context, roots []string, registry *parserapi.Registry, options FreshnessCoordinatorOptions) (*FreshnessCoordinator, *FreshnessGeneration, error)
NewFreshnessCoordinator performs the one required startup refresh and opens the first validated query-only generation before returning.
Types ¶
type CatalogInput ¶
type CatalogInput struct {
Repository string `json:"repository,omitempty" jsonschema:"restrict results to one indexed repository by name"`
Name string `json:"name,omitempty" jsonschema:"optional name or qualified-name fragment"`
PathPrefixes []string `json:"path_prefixes,omitempty" jsonschema:"repository-relative segment prefixes selecting canonical result locations"`
Limit int `` /* 168-byte string literal not displayed */
}
type DataResourceInput ¶
type DataResourceInput struct {
CatalogInput
Kinds []string `json:"kinds,omitempty" jsonschema:"data resource kinds to catalog; defaults to table and view"`
}
type DataResourceUsageInput ¶
type DataResourceUsageInput struct {
Selector string `json:"selector" jsonschema:"table or view name, qualified name, or stable node ID"`
Repository string `json:"repository,omitempty" jsonschema:"restrict resolution to one indexed repository by name"`
Limit int `json:"limit,omitempty" jsonschema:"maximum evidence sites per relation; defaults to 100 and may not exceed 1000"`
}
DataResourceUsageInput deliberately omits the catalog name filter: the selector already names the resource.
type EndpointInput ¶
type EndpointInput struct {
Repository string `json:"repository,omitempty" jsonschema:"restrict results to one indexed repository service by stable name"`
Method string `json:"method,omitempty" jsonschema:"exact HTTP method such as GET or POST"`
Route string `json:"route,omitempty" jsonschema:"canonical-compatible route path or template"`
PathPrefixes []string `json:"path_prefixes,omitempty" jsonschema:"repository-relative segment prefixes selecting local result anchors"`
Limit int `json:"limit,omitempty" jsonschema:"maximum entries or links; defaults to 100 and may not exceed 1000"`
}
type FailureFlowInput ¶
type FailureFlowInput struct {
Selector string `json:"selector,omitempty" jsonschema:"qualified function, method, error identity, callee, or stable node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of selectors reported in caller order"`
Kind string `` /* 127-byte string literal not displayed */
Direction string `json:"direction,omitempty" jsonschema:"outgoing, incoming, or both; defaults to both"`
Limit int `json:"limit,omitempty" jsonschema:"maximum facts per report section; defaults to 1000"`
}
type FailureFlowOutput ¶
type FailureFlowOutput struct {
query.FailureFlow
Results []ResultEnvelope[query.FailureFlow] `json:"results,omitempty"`
}
type FindReusableCodeInput ¶
type FindReusableCodeInput struct {
Query string `json:"query" jsonschema:"natural-language description of code to reuse"`
Limit int `json:"limit,omitempty" jsonschema:"maximum candidates; defaults to 5"`
// Every field below is optional, so the historical two-field call is
// unchanged.
BudgetSeconds int `` /* 185-byte string literal not displayed */
Languages []string `json:"languages,omitempty" jsonschema:"restrict candidates to these node languages"`
PathPrefixes []string `json:"path_prefixes,omitempty" jsonschema:"restrict candidates to repository-relative segment prefixes"`
}
type FindSymbolsInput ¶
type FindSymbolsInput struct {
Query string `json:"query,omitempty" jsonschema:"name or qualified-name fragment to find"`
Queries []string `json:"queries,omitempty" jsonschema:"batch of name fragments searched in caller order"`
Limit int `json:"limit,omitempty" jsonschema:"maximum matches per query; defaults to 20"`
}
type FindSymbolsOutput ¶
type FindSymbolsOutput struct {
Matches []graph.Node `json:"matches,omitempty"`
Results []ResultEnvelope[[]graph.Node] `json:"results,omitempty"`
}
type FreshnessCoordinator ¶
type FreshnessCoordinator struct {
// contains filtered or unexported fields
}
FreshnessCoordinator owns source probes, writer refreshes, publication, and complete-handler read leases for one MCP session.
func (*FreshnessCoordinator) Acquire ¶
func (c *FreshnessCoordinator) Acquire(ctx context.Context) (*FreshnessGeneration, func(), error)
Acquire proves source freshness and returns a lease valid until release. The release function must be called exactly once after the complete tool result has been constructed.
func (*FreshnessCoordinator) Close ¶
func (c *FreshnessCoordinator) Close() error
Close drains active leases and closes the published query-only generation.
type FreshnessCoordinatorOptions ¶
type FreshnessCoordinatorOptions struct {
MaxFileSize int64
MaxAttempts int
// DeferStartupRefresh publishes a provisional generation from the indexes
// already on disk instead of refreshing before returning. The transport can
// then answer `initialize` immediately, and the first Acquire performs the
// refresh. Capability-conditional tool registration still sees a real
// repository, so the advertised tool list does not depend on refresh
// timing. See issue #173.
DeferStartupRefresh bool
}
FreshnessCoordinatorOptions controls bounded freshness work. The zero value uses the indexer's production file bound and three stability attempts.
type FreshnessDiagnostics ¶
type FreshnessDiagnostics struct {
Attempts int
Probes int
GitCommands int
Refreshed []string
Skipped []string
Fallbacks map[string]string
Reports []indexer.Report
Elapsed time.Duration
}
FreshnessDiagnostics is retained for debug and benchmark inspection. It is deliberately not included in normal MCP tool payloads.
type FreshnessGeneration ¶
type FreshnessGeneration struct {
Key string
Repository graph.ReadRepository
Projects []indexer.Project
Diagnostics FreshnessDiagnostics
// contains filtered or unexported fields
}
FreshnessGeneration is an immutable, query-only repository generation.
type GodotCompositionInput ¶
type GodotCompositionInput struct {
Selector string `` /* 127-byte string literal not displayed */
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of Godot selectors reported in caller order"`
Kind string `` /* 164-byte string literal not displayed */
Depth int `json:"depth,omitempty" jsonschema:"maximum scene-tree depth explored for a scene; defaults to 8"`
Limit int `json:"limit,omitempty" jsonschema:"maximum relations per section; defaults to 1000"`
}
GodotCompositionInput bounds one composition report or a batch of them.
type GodotCompositionOutput ¶
type GodotCompositionOutput struct {
query.GodotComposition
Results []ResultEnvelope[query.GodotComposition] `json:"results,omitempty"`
}
GodotCompositionOutput embeds the single report so scalar callers read it at the top level while batched callers read Results.
type GodotInteractionsInput ¶
type GodotInteractionsInput struct {
Selector string `` /* 148-byte string literal not displayed */
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of Godot selectors reported in caller order"`
Kind string `` /* 177-byte string literal not displayed */
Filters []string `` /* 127-byte string literal not displayed */
Direction string `json:"direction,omitempty" jsonschema:"outgoing, incoming, or both; defaults to both"`
Depth int `json:"depth,omitempty" jsonschema:"maximum scene-tree depth explored for a scene; defaults to 8"`
Limit int `json:"limit,omitempty" jsonschema:"maximum interactions per direction; defaults to 1000"`
}
GodotInteractionsInput bounds one interactions report or a batch of them.
type GodotInteractionsOutput ¶
type GodotInteractionsOutput struct {
query.GodotInteractions
Results []ResultEnvelope[query.GodotInteractions] `json:"results,omitempty"`
}
GodotInteractionsOutput embeds the single report so scalar callers read it at the top level while batched callers read Results.
type HandlerInput ¶
type HandlerInput struct {
Repository string `json:"repository,omitempty" jsonschema:"restrict results to one indexed repository service by stable name"`
Method string `json:"method,omitempty" jsonschema:"exact HTTP method such as GET or POST"`
Route string `json:"route,omitempty" jsonschema:"canonical-compatible route path or template"`
Event string `json:"event,omitempty" jsonschema:"literal event name fragment; cannot be combined with method or route"`
Limit int `json:"limit,omitempty" jsonschema:"maximum handler matches; defaults to 100 and may not exceed 1000"`
}
type ImpactInput ¶
type ImpactInput struct {
Selector string `json:"selector,omitempty" jsonschema:"qualified symbol name or stable node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of symbol names or node IDs reported in caller order"`
Depth int `json:"depth,omitempty" jsonschema:"depth applied to both directions unless a per-direction depth is given"`
Limit int `json:"limit,omitempty" jsonschema:"node limit applied to both directions unless a per-direction limit is given"`
UpstreamDepth int `json:"upstream_depth,omitempty" jsonschema:"maximum depth of dependents; defaults to 4"`
DownstreamDepth int `json:"downstream_depth,omitempty" jsonschema:"maximum depth of dependencies; defaults to 4"`
UpstreamLimit int `json:"upstream_limit,omitempty" jsonschema:"maximum dependent nodes; defaults to 1000"`
DownstreamLimit int `json:"downstream_limit,omitempty" jsonschema:"maximum dependency nodes; defaults to 1000"`
IncludeSource bool `json:"include_source,omitempty" jsonschema:"include bounded source excerpts for the most relevant nodes"`
ContextLines int `json:"context_lines,omitempty" jsonschema:"excerpt context lines from 0 to 20"`
MaxLines int `json:"max_lines,omitempty" jsonschema:"maximum lines per excerpt; defaults to 200"`
SourceLimit int `json:"source_limit,omitempty" jsonschema:"maximum excerpts; defaults to 10"`
Kind string `json:"kind,omitempty" jsonschema:"optional node kind the selector must resolve to, such as function, method, type, or field"`
}
ImpactInput keeps the original selector, depth, and limit fields working while adding independent per-direction bounds and optional source.
type ImpactOutput ¶
type ImpactOutput struct {
query.ImpactReport
Results []ResultEnvelope[query.ImpactReport] `json:"results,omitempty"`
}
ImpactOutput embeds the single report so scalar callers read it at the top level while batched callers read Results.
type MessageCoverageInput ¶
type MessageCoverageInput struct {
Repository string `` /* 131-byte string literal not displayed */
Package string `json:"package,omitempty" jsonschema:"exact canonical protocol package"`
Message string `json:"message,omitempty" jsonschema:"exact message name or qualified canonical message name"`
Oneof string `json:"oneof,omitempty" jsonschema:"exact oneof name; each selected arm is evaluated independently"`
Direction string `json:"direction,omitempty" jsonschema:"outgoing, incoming, or both; defaults to both"`
Component string `json:"component,omitempty" jsonschema:"restrict application evidence to one exact component name or stable component ID"`
Status string `json:"status,omitempty" jsonschema:"resolved, missing_evidence, or unknown"`
PathPrefixes []string `json:"path_prefixes,omitempty" jsonschema:"repository-relative segment prefixes selecting canonical message declarations"`
Limit int `` /* 131-byte string literal not displayed */
}
type MessageFlowInput ¶
type MessageFlowInput struct {
Selector string `json:"selector,omitempty" jsonschema:"canonical message name, qualified name, or stable canonical node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of canonical message selectors resolved in caller order"`
Repository string `` /* 141-byte string literal not displayed */
Component string `json:"component,omitempty" jsonschema:"restrict application evidence to one exact component name or stable component ID"`
Direction string `json:"direction,omitempty" jsonschema:"outgoing, incoming, or both; defaults to both"`
Limit int `json:"limit,omitempty" jsonschema:"maximum evidence sites per exact relation; defaults to 100 and may not exceed 1000"`
}
type MessageFlowOutput ¶
type MessageFlowOutput struct {
query.MessageFlow
Results []ResultEnvelope[query.MessageFlow] `json:"results,omitempty"`
}
type NodeOutput ¶
type NodeOutput struct {
Node graph.Node `json:"node,omitzero"`
Results []ResultEnvelope[graph.Node] `json:"results,omitempty"`
}
type PathInput ¶
type PathInput struct {
From string `json:"from,omitempty" jsonschema:"starting qualified symbol name or node ID"`
To string `json:"to,omitempty" jsonschema:"destination qualified symbol name or node ID"`
Pairs []PathPair `json:"pairs,omitempty" jsonschema:"batch of from/to pairs resolved in caller order"`
Direction string `json:"direction,omitempty" jsonschema:"outgoing, incoming, or both"`
Relations []string `json:"relations,omitempty" jsonschema:"optional edge kinds to follow"`
Limit int `json:"limit,omitempty" jsonschema:"maximum visited nodes"`
Kind string `` /* 126-byte string literal not displayed */
}
type PathOutput ¶
type PathOutput struct {
query.Path
Results []ResultEnvelope[query.Path] `json:"results,omitempty"`
}
PathOutput embeds the single path so scalar callers keep reading the original top-level fields while batched callers read Results.
type PathPair ¶
type PathPair struct {
From string `json:"from" jsonschema:"starting qualified symbol name or node ID"`
To string `json:"to" jsonschema:"destination qualified symbol name or node ID"`
}
PathPair is one batched from/to request.
type ResultEnvelope ¶
type ResultEnvelope[T any] struct { Index int `json:"index"` Input string `json:"input,omitempty"` Value *T `json:"value,omitempty"` Error string `json:"error,omitempty"` }
ResultEnvelope carries the outcome of one batched input. Results keep the caller's order, and a failed input reports its own error without erasing unrelated successful results.
type ReusableSearch ¶
type ReusableSearch func(context.Context, semantic.SearchRequest) (semantic.SearchResult, error)
ReusableSearch answers one bounded reusable-code query. The request carries the optional time budget and candidate filters, so the transport never has to choose between blocking and dropping them.
type SearchSourceInput ¶
type SearchSourceInput struct {
Pattern string `json:"pattern,omitempty" jsonschema:"literal text, or an RE2 pattern when regex is true"`
Patterns []string `json:"patterns,omitempty" jsonschema:"batch of patterns searched in one pass"`
Regex bool `json:"regex,omitempty" jsonschema:"compile patterns as Go RE2 instead of matching literally"`
CaseSensitive bool `json:"case_sensitive,omitempty" jsonschema:"match case exactly; defaults to case-insensitive"`
PathPrefixes []string `json:"path_prefixes,omitempty" jsonschema:"optional repository-relative path prefixes"`
Languages []string `json:"languages,omitempty" jsonschema:"optional indexed language filters"`
Repositories []string `json:"repositories,omitempty" jsonschema:"optional repository name filters"`
ContextLines int `json:"context_lines,omitempty" jsonschema:"surrounding lines from 0 to 20"`
MaxMatchesPerFile int `json:"max_matches_per_file,omitempty" jsonschema:"per-file match cap; defaults to 50"`
MaxMatchesPattern int `json:"max_matches_per_pattern,omitempty" jsonschema:"per-pattern match cap; defaults to 200"`
MaxMatches int `json:"max_matches,omitempty" jsonschema:"total match cap; defaults to 500"`
MaxFileBytes int64 `json:"max_file_bytes,omitempty" jsonschema:"largest file searched; defaults to 1048576"`
}
type SelectorInput ¶
type SelectorInput struct {
Selector string `json:"selector,omitempty" jsonschema:"qualified symbol name or stable node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of qualified symbol names or stable node IDs resolved in caller order"`
Kind string `json:"kind,omitempty" jsonschema:"optional node kind the selector must resolve to, such as function, method, type, or field"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewFederated ¶
func NewFederated(repository graph.ReadRepository, projects []indexer.Project) *Service
func (*Service) WithFreshness ¶
func (s *Service) WithFreshness(coordinator *FreshnessCoordinator) *Service
WithFreshness configures generation-bound acquisition for every complete tool invocation. It supersedes the legacy error-only refresh hook.
func (*Service) WithRefresh ¶
WithRefresh configures a synchronization hook that runs before every tool call. It keeps a long-lived MCP session aligned with the active worktrees.
func (*Service) WithReusable ¶
func (s *Service) WithReusable(search ReusableSearch) *Service
func (*Service) WithReusableFactory ¶
func (s *Service) WithReusableFactory(factory func(graph.ReadRepository, []indexer.Project) ReusableSearch) *Service
WithReusableFactory keeps embedding work bound to the source generation acquired for the tool call while retaining its separate writable lifecycle.
func (*Service) WithSearch ¶
WithSearch enables bounded content search over the refreshed indexes.
func (*Service) WithSearchFactory ¶
func (s *Service) WithSearchFactory(factory func(graph.ReadRepository, []indexer.Project) (*search.Service, error)) *Service
WithSearchFactory rebuilds bounded source search for each generation.
func (*Service) WithSource ¶
func (*Service) WithSourceFactory ¶
func (s *Service) WithSourceFactory(factory func(graph.ReadRepository, []indexer.Project) (func(context.Context, string, graph.NodeKind, int, int) (sourcecontext.Excerpt, error), error)) *Service
WithSourceFactory rebuilds the source reader whenever a new query-only generation is published.
type ServiceTopologyInput ¶
type ServiceTopologyInput struct {
Repository string `json:"repository,omitempty" jsonschema:"restrict results to every component and fallback service in one indexed repository"`
Component string `json:"component,omitempty" jsonschema:"restrict results to this exact indexed component name across selected repositories"`
Method string `json:"method,omitempty" jsonschema:"exact HTTP method such as GET or POST"`
Route string `json:"route,omitempty" jsonschema:"canonical-compatible route path or template"`
Event string `json:"event,omitempty" jsonschema:"literal event name fragment; cannot be combined with method or route"`
Direction string `` /* 133-byte string literal not displayed */
PathPrefixes []string `` /* 128-byte string literal not displayed */
Limit int `json:"limit,omitempty" jsonschema:"maximum service links; defaults to 100 and may not exceed 1000"`
}
type SourceInput ¶
type SourceInput struct {
Selector string `json:"selector,omitempty" jsonschema:"qualified symbol name or stable node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of symbol names or node IDs read in caller order"`
ContextLines int `json:"context_lines,omitempty" jsonschema:"surrounding lines from 0 to 20"`
MaxLines int `json:"max_lines,omitempty" jsonschema:"maximum returned lines per excerpt; defaults to 200 and may not exceed 1000"`
Kind string `json:"kind,omitempty" jsonschema:"optional node kind the selector must resolve to, such as function, method, type, or field"`
}
type SourceOutput ¶
type SourceOutput struct {
sourcecontext.Excerpt
Results []ResultEnvelope[sourcecontext.Excerpt] `json:"results,omitempty"`
}
SourceOutput embeds the single excerpt so scalar callers keep reading the original top-level fields while batched callers read Results.
type StatusInput ¶
type StatusInput struct{}
type StatusOutput ¶
type TestCoverageInput ¶
type TestCoverageInput struct {
Selector string `json:"selector,omitempty" jsonschema:"qualified symbol name or stable node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of qualified symbol names or stable node IDs resolved in caller order"`
Depth int `json:"depth,omitempty" jsonschema:"maximum structural helper depth; defaults to 8 and may not exceed 32"`
Limit int `json:"limit,omitempty" jsonschema:"maximum structural matches and traversal work; defaults to 100 and may not exceed 1000"`
Kind string `json:"kind,omitempty" jsonschema:"optional production node kind for find_tests selector resolution"`
}
type TestCoverageOutput ¶
type TestCoverageOutput struct {
query.TestCoverageReport
Results []ResultEnvelope[query.TestCoverageReport] `json:"results,omitempty"`
}
type TraversalInput ¶
type TraversalInput struct {
Selector string `json:"selector,omitempty" jsonschema:"qualified symbol name or stable node ID"`
Selectors []string `json:"selectors,omitempty" jsonschema:"batch of symbol names or node IDs traversed in caller order"`
Depth int `json:"depth,omitempty" jsonschema:"maximum traversal depth"`
Direction string `json:"direction,omitempty" jsonschema:"outgoing, incoming, or both"`
Relations []string `json:"relations,omitempty" jsonschema:"optional edge kinds to follow"`
Limit int `json:"limit,omitempty" jsonschema:"maximum visited nodes"`
Kind string `json:"kind,omitempty" jsonschema:"optional node kind the selector must resolve to, such as function, method, type, or field"`
}
type TraversalOutput ¶
type TraversalOutput struct {
query.Traversal
Results []ResultEnvelope[query.Traversal] `json:"results,omitempty"`
}
TraversalOutput embeds the single traversal so scalar callers keep reading the original top-level fields while batched callers read Results.