tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(s *mcp.Server, sc DocumentScanner, graph GraphStore, search ContentSearcher, semantic SemanticSearch, metrics *ToolMetrics, docMetrics *DocMetrics, cache *memory.ContentCache, readOnly bool, auditReader AuditReader)

Types

type AddObservationsArgs

type AddObservationsArgs struct {
	Observations []memory.Observation `json:"observations" jsonschema:"observations to add"`
}

type AddObservationsResult

type AddObservationsResult struct {
	Observations []memory.Observation `json:"observations"`

	Skipped []SkippedObservation `json:"skipped,omitempty"`
}

type AuditReader added in v0.1.0

type AuditReader interface {
	Query(ctx context.Context, filter memory.AuditFilter) ([]memory.AuditEvent, int64, error)

	Summary(ctx context.Context, window time.Duration) (memory.AuditSummary, error)
}

type ContentSearcher

type ContentSearcher interface {
	Search(query, repo, fileType string) ([]memory.ContentMatch, error)

	Count() (int64, error)

	SearchMode() string
}

type CreateEntitiesArgs

type CreateEntitiesArgs struct {
	Entities []memory.Entity `json:"entities" jsonschema:"entities to create"`
}

type CreateEntitiesResult

type CreateEntitiesResult struct {
	Entities []memory.Entity `json:"entities"`

	Skipped []SkippedObservation `json:"skipped,omitempty"`
}

type CreateRelationsArgs

type CreateRelationsArgs struct {
	Relations []memory.Relation `json:"relations" jsonschema:"relations to create"`
}

type CreateRelationsResult

type CreateRelationsResult struct {
	Relations []memory.Relation `json:"relations"`
}

type DeleteEntitiesArgs

type DeleteEntitiesArgs struct {
	EntityNames []string `json:"entityNames" jsonschema:"Entities to delete."`

	Confirm bool `` /* 163-byte string literal not displayed */
}

type DeleteObservationsArgs

type DeleteObservationsArgs struct {
	Deletions []memory.Observation `json:"deletions" jsonschema:"observations to delete"`
}

type DeleteRelationsArgs

type DeleteRelationsArgs struct {
	Relations []memory.Relation `json:"relations" jsonschema:"relations to delete"`
}

type DiscoverMCPServersArgs added in v0.1.0

type DiscoverMCPServersArgs struct {
	Repo string `json:"repo,omitzero"      jsonschema:"Filter results to a specific repository name."`

	ToolName string `` /* 181-byte string literal not displayed */

	Transport string `json:"transport,omitzero" jsonschema:"Filter by transport type: stdio, http, or sse."`

	Limit int `json:"limit,omitzero"     jsonschema:"Maximum number of servers to return (default 20, max 100)."`
}

type DiscoverMCPServersResult added in v0.1.0

type DiscoverMCPServersResult struct {
	Servers []MCPServerResult `json:"servers"`

	Total int `json:"total"`
}

type DocAccess

type DocAccess struct {
	Repo string `json:"repo"`

	Path string `json:"path"`

	Count int64 `json:"count"`
}

type DocMetrics

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

func NewDocMetrics

func NewDocMetrics() *DocMetrics

func (*DocMetrics) Record

func (d *DocMetrics) Record(repo, path string)

func (*DocMetrics) TopN

func (d *DocMetrics) TopN(n int) []DocAccess

type DocumentScanner

type DocumentScanner interface {
	ListRepos() []scanner.RepoInfo

	SearchDocs(query string) []scanner.FileEntry

	GetFileContent(ctx context.Context, repo string, path string) (string, error)

	Status() (scanning bool, lastScan time.Time, repoCount int)

	TriggerScan() bool
}

type ExportGraphArgs added in v0.1.0

type ExportGraphArgs struct {
	Format string `` /* 143-byte string literal not displayed */

	Title string `` /* 126-byte string literal not displayed */

	OutputPath string `` /* 153-byte string literal not displayed */
}

type ExportGraphResult added in v0.1.0

type ExportGraphResult struct {
	Format string `json:"format"`

	EntityCount int `json:"entity_count"`

	EdgeCount int `json:"edge_count"`

	OutputPath string `json:"output_path,omitempty"`

	Content string `json:"content,omitempty"`
}

type FindPathArgs

type FindPathArgs struct {
	From string `json:"from"               jsonschema:"Name of the starting entity."`

	To string `json:"to"                 jsonschema:"Name of the destination entity."`

	MaxDepth int `json:"max_depth,omitempty" jsonschema:"Maximum number of hops to search (1–10). Defaults to 6 when omitted."`
}

type FindPathResult

type FindPathResult struct {
	Path []memory.PathEdge `json:"path"`

	Found bool `json:"found"`

	Hops int `json:"hops"`
}

type GetAuditSummaryArgs added in v0.1.0

type GetAuditSummaryArgs struct {
	WindowHours int `` /* 135-byte string literal not displayed */
}

type GetAuditSummaryResult added in v0.1.0

type GetAuditSummaryResult struct {
	WindowHours int `json:"window_hours"`

	Summary memory.AuditSummary `json:"summary"`
}

type GetFileContentArgs

type GetFileContentArgs struct {
	Repo string `` /* 134-byte string literal not displayed */

	Path string `json:"path" jsonschema:"The file path within the repository (e.g. 'docs/guide.md' or 'README.md')."`
}

type GraphAuditLogger

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

func NewGraphAuditLogger

func NewGraphAuditLogger(inner GraphStore, agentFn func() string, store memory.AuditStore) *GraphAuditLogger

func (*GraphAuditLogger) AddObservations

func (a *GraphAuditLogger) AddObservations(observations []memory.Observation) ([]memory.Observation, error)

func (*GraphAuditLogger) CreateEntities

func (a *GraphAuditLogger) CreateEntities(entities []memory.Entity) ([]memory.Entity, error)

func (*GraphAuditLogger) CreateRelations

func (a *GraphAuditLogger) CreateRelations(relations []memory.Relation) ([]memory.Relation, error)

func (*GraphAuditLogger) DeleteEntities

func (a *GraphAuditLogger) DeleteEntities(entityNames []string) error

func (*GraphAuditLogger) DeleteObservations

func (a *GraphAuditLogger) DeleteObservations(deletions []memory.Observation) error

func (*GraphAuditLogger) DeleteRelations

func (a *GraphAuditLogger) DeleteRelations(relations []memory.Relation) error

func (*GraphAuditLogger) EntityCount

func (a *GraphAuditLogger) EntityCount() (int64, error)

func (*GraphAuditLogger) EntityTypeCounts

func (a *GraphAuditLogger) EntityTypeCounts() (map[string]int64, error)

func (*GraphAuditLogger) FindPath

func (a *GraphAuditLogger) FindPath(from, to string, maxDepth int) ([]memory.PathEdge, error)

func (*GraphAuditLogger) GetIntegrationMap

func (a *GraphAuditLogger) GetIntegrationMap(ctx context.Context, service string, depth int) (memory.IntegrationMap, error)

func (*GraphAuditLogger) ListEntities

func (a *GraphAuditLogger) ListEntities(entityType string) (memory.KnowledgeGraph, error)

func (*GraphAuditLogger) ListRelations

func (a *GraphAuditLogger) ListRelations(relationType, fromEntity string) ([]memory.Relation, error)

func (*GraphAuditLogger) OpenNodes

func (a *GraphAuditLogger) OpenNodes(names []string) (memory.KnowledgeGraph, error)

func (*GraphAuditLogger) OpenNodesFiltered

func (a *GraphAuditLogger) OpenNodesFiltered(names []string, includeArchived bool) (memory.KnowledgeGraph, error)

func (*GraphAuditLogger) ReadGraph

func (a *GraphAuditLogger) ReadGraph() (memory.KnowledgeGraph, error)

func (*GraphAuditLogger) SearchNodes

func (a *GraphAuditLogger) SearchNodes(query string) (memory.KnowledgeGraph, error)

func (*GraphAuditLogger) SearchNodesFiltered

func (a *GraphAuditLogger) SearchNodesFiltered(query string, includeArchived bool) (memory.KnowledgeGraph, error)

func (*GraphAuditLogger) TraverseGraph

func (a *GraphAuditLogger) TraverseGraph(entity, relationType, direction string, maxDepth int) ([]memory.TraverseNode, []memory.TraverseEdge, error)

func (*GraphAuditLogger) UpdateEntity

func (a *GraphAuditLogger) UpdateEntity(oldName, newName, newType string) error

type GraphStore

type GraphStore interface {
	CreateEntities(entities []memory.Entity) ([]memory.Entity, error)

	CreateRelations(relations []memory.Relation) ([]memory.Relation, error)

	AddObservations(observations []memory.Observation) ([]memory.Observation, error)

	DeleteEntities(entityNames []string) error

	DeleteObservations(deletions []memory.Observation) error

	DeleteRelations(relations []memory.Relation) error

	ReadGraph() (memory.KnowledgeGraph, error)

	SearchNodes(query string) (memory.KnowledgeGraph, error)

	SearchNodesFiltered(query string, includeArchived bool) (memory.KnowledgeGraph, error)

	OpenNodes(names []string) (memory.KnowledgeGraph, error)

	OpenNodesFiltered(names []string, includeArchived bool) (memory.KnowledgeGraph, error)

	EntityCount() (int64, error)

	EntityTypeCounts() (map[string]int64, error)

	TraverseGraph(entity, relationType, direction string, maxDepth int) ([]memory.TraverseNode, []memory.TraverseEdge, error)

	GetIntegrationMap(ctx context.Context, service string, depth int) (memory.IntegrationMap, error)

	ListEntities(entityType string) (memory.KnowledgeGraph, error)

	ListRelations(relationType, fromEntity string) ([]memory.Relation, error)

	FindPath(from, to string, maxDepth int) ([]memory.PathEdge, error)

	UpdateEntity(oldName, newName, newType string) error
}

type IngestURLArgs added in v0.1.0

type IngestURLArgs struct {
	URL string `json:"url"                   jsonschema:"required,The full URL to fetch and ingest (must start with http:// or https://)."`

	EntityName string `json:"entity_name,omitempty" jsonschema:"Optional name for the graph entity. Defaults to the page title if omitted."`

	EntityType string `json:"entity_type,omitempty" jsonschema:"Entity type to assign (e.g. 'api', 'service', 'doc'). Defaults to 'doc'."`
}

type IngestURLResult added in v0.1.0

type IngestURLResult struct {
	EntityName string `json:"entity_name"`

	URL string `json:"url"`

	ObservationCount int `json:"observation_count"`

	Cached bool `json:"cached"`

	Observations []string `json:"observations"`
}

type IntegrationEdgeJSON

type IntegrationEdgeJSON struct {
	Target string `json:"target"`

	Schema string `json:"schema,omitempty"`

	Version string `json:"version,omitempty"`

	Paths int `json:"paths,omitempty"`

	Confidence string `json:"confidence"`

	SourceRepo string `json:"source_repo,omitempty"`
}

type IntegrationMapArgs

type IntegrationMapArgs struct {
	Service string `json:"service"         jsonschema:"required,Entity name of the service in the knowledge graph (e.g. 'checkout-service')."`

	Depth int `` /* 133-byte string literal not displayed */
}

type IntegrationMapResult

type IntegrationMapResult struct {
	Service string `json:"service"`

	Publishes []IntegrationEdgeJSON `json:"publishes"`

	Subscribes []IntegrationEdgeJSON `json:"subscribes"`

	ExposesAPI []IntegrationEdgeJSON `json:"exposes_api"`

	ProvidesGRPC []IntegrationEdgeJSON `json:"provides_grpc"`

	GRPCDeps []IntegrationEdgeJSON `json:"grpc_deps"`

	Calls []IntegrationEdgeJSON `json:"calls"`

	Coverage string `` /* 138-byte string literal not displayed */
}

type ListEntitiesArgs

type ListEntitiesArgs struct {
	EntityType string `` /* 202-byte string literal not displayed */
}

type ListRelationsArgs

type ListRelationsArgs struct {
	RelationType string `` /* 265-byte string literal not displayed */

	FromEntity string `` /* 166-byte string literal not displayed */
}

type ListRelationsResult

type ListRelationsResult struct {
	Relations []memory.Relation `json:"relations"`

	Count int `json:"count"`
}

type ListReposArgs

type ListReposArgs struct {
	FileType string `` /* 221-byte string literal not displayed */
}

type ListReposResult

type ListReposResult struct {
	Repos []repoSummary `json:"repos" jsonschema:"List of repositories with documentation"`
}

type MCPServerResult added in v0.1.0

type MCPServerResult struct {
	Name string `json:"name"`

	Repo string `json:"repo"`

	Transport string `json:"transport,omitzero"`

	Command string `json:"command,omitzero"`

	URL string `json:"url,omitzero"`

	Tools []string `json:"tools"`

	ConfigFile string `json:"config_file,omitzero"`
}

type OpenNodesArgs

type OpenNodesArgs struct {
	Names []string `json:"names" jsonschema:"names of nodes to open"`

	IncludeArchived bool `` /* 175-byte string literal not displayed */
}

type QueryAuditLogArgs added in v0.1.0

type QueryAuditLogArgs struct {
	Agent string `json:"agent,omitempty"     jsonschema:"Filter events by agent name (e.g. claude-desktop, indexer-bot)."`

	Tool string `json:"tool,omitempty"      jsonschema:"Filter events by MCP tool name (e.g. create_entities, delete_entities)."`

	Operation string `json:"operation,omitempty" jsonschema:"Filter by operation type: create, delete, update, or add."`

	Outcome string `json:"outcome,omitempty"   jsonschema:"Filter by outcome: ok or error."`

	Since string `json:"since,omitempty"     jsonschema:"Return only events after this RFC3339 timestamp (e.g. 2026-04-21T00:00:00Z)."`

	Limit int `json:"limit,omitempty"     jsonschema:"Maximum events to return (default 50, max 500)."`
}

type QueryAuditLogResult added in v0.1.0

type QueryAuditLogResult struct {
	Events []memory.AuditEvent `json:"events"`

	Total int64 `json:"total"`
}

type RawContentResult

type RawContentResult struct {
	Content string `json:"content" jsonschema:"The raw text content of the file."`
}

type ScanStatusArgs

type ScanStatusArgs struct{}

type ScanStatusResult

type ScanStatusResult struct {
	Scanning bool `json:"scanning"`

	LastScanAt time.Time `json:"last_scan_at"`

	RepoCount int `json:"repo_count"`

	ContentIndexed int64 `json:"content_indexed"`

	GraphEntities int64 `json:"graph_entities"`

	ContentEnabled bool `json:"content_enabled"`

	EntityBreakdown map[string]int64 `json:"entity_breakdown,omitempty"`

	SearchMode string `json:"search_mode,omitempty"`

	ReadOnly bool `json:"read_only"`
}

type SearchContentArgs

type SearchContentArgs struct {
	Query string `` /* 157-byte string literal not displayed */

	Repo string `json:"repo,omitempty" jsonschema:"Optional: filter results to a single repository name (e.g. 'org/payment-service')."`

	FileType string `` /* 227-byte string literal not displayed */
}

type SearchContentResult

type SearchContentResult struct {
	Matches []memory.ContentMatch `json:"matches" jsonschema:"List of files containing the query term, with a snippet showing the matched context."`
}

type SearchDocsArgs

type SearchDocsArgs struct {
	Query string `json:"query" jsonschema:"The search term to match against file paths and repo names."`

	FileType string `` /* 194-byte string literal not displayed */
}

type SearchDocsResult

type SearchDocsResult struct {
	Files []scanner.FileEntry `json:"files" jsonschema:"List of files matching the query"`
}

type SearchNodesArgs

type SearchNodesArgs struct {
	Query string `json:"query" jsonschema:"query string"`

	IncludeArchived bool `` /* 175-byte string literal not displayed */
}

type SemanticSearch

type SemanticSearch interface {
	Enabled() bool

	SearchDocs(ctx context.Context, query, repo string, topK int) ([]embeddings.DocResult, int, error)

	SearchEntities(ctx context.Context, query string, topK int) ([]embeddings.EntityResult, int, error)

	ScheduleIndexEntities(names []string)

	IndexDocs(ctx context.Context, repo string)
}

type SemanticSearchArgs

type SemanticSearchArgs struct {
	Query string `json:"query"            jsonschema:"Natural-language search query. Required."`

	Target string `` /* 139-byte string literal not displayed */

	TopK int `json:"top_k,omitempty"  jsonschema:"Maximum number of results per target (default 5, max 20)."`

	Repo string `` /* 130-byte string literal not displayed */
}

type SemanticSearchResult

type SemanticSearchResult struct {
	ContentResults []embeddings.DocResult `json:"content_results,omitempty"`

	EntityResults []embeddings.EntityResult `json:"entity_results,omitempty"`

	StaleDocs int `json:"stale_docs"`

	StaleEntities int `json:"stale_entities"`
}

type SkippedObservation

type SkippedObservation struct {
	EntityName string `json:"entity_name"`

	Observation string `json:"observation"`

	Reason string `json:"reason"`
}

type ToolMetrics

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

func NewToolMetrics

func NewToolMetrics() *ToolMetrics

func (*ToolMetrics) Record

func (m *ToolMetrics) Record(toolName string)

func (*ToolMetrics) Snapshot

func (m *ToolMetrics) Snapshot() map[string]int64

type TraverseGraphArgs

type TraverseGraphArgs struct {
	Entity string `` /* 126-byte string literal not displayed */

	RelationType string `` /* 147-byte string literal not displayed */

	Direction string `` /* 182-byte string literal not displayed */

	Depth int `` /* 175-byte string literal not displayed */
}

type TraverseGraphResult

type TraverseGraphResult struct {
	StartEntity string `json:"start_entity"`

	Nodes []memory.TraverseNode `json:"nodes"`

	Edges []memory.TraverseEdge `json:"edges"`

	TotalFound int `json:"total_found"`
}

type TriggerScanArgs

type TriggerScanArgs struct{}

type TriggerScanResult

type TriggerScanResult struct {
	Triggered bool `json:"triggered"`

	AlreadyQueued bool `json:"already_queued"`
}

type UpdateEntityArgs

type UpdateEntityArgs struct {
	Name string `json:"name"               jsonschema:"Current name of the entity to update. Must match exactly."`

	NewName string `` /* 157-byte string literal not displayed */

	NewType string `json:"new_type,omitempty" jsonschema:"New entity type (e.g. 'service', 'team', 'api'). Omit to keep the current type."`
}

type UpdateEntityResult

type UpdateEntityResult struct {
	Updated bool `json:"updated"`

	Name string `json:"name"` // effective name after update

}

type UsageStatsArgs

type UsageStatsArgs struct{}

type UsageStatsResult

type UsageStatsResult struct {
	ToolCalls map[string]int64 `` /* 126-byte string literal not displayed */

	TopDocuments []DocAccess `` /* 198-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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