symbols

package
v1.10.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTools

func RegisterTools(server *mcp.SerenaMCPServer, k *kernel.Kernel, wsKeyFn func() workspace.WorkspaceKey)

RegisterTools registers all 9 symbol retrieval tools with the MCP server. Each handler is wrapped with kernel.WrapToolSpan to produce kernel.tool.{name} sub-spans under the TelemetryMiddleware span (Phase 12, TRACE-03).

func SymbolKindName

func SymbolKindName(kind gen.SymbolKind) string

SymbolKindName converts a SymbolKind enum to a human-readable string.

Types

type BlastRadius

type BlastRadius struct {
	DirectRefs      []SymbolLocation
	Callers         []HierarchyNode
	Implementations []SymbolLocation
	AffectedFiles   []string // unique files across all results
	TotalImpact     int      // total unique locations
}

BlastRadius represents the combined impact analysis for a symbol.

func AnalyzeBlastRadius

func AnalyzeBlastRadius(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int) (*BlastRadius, error)

AnalyzeBlastRadius combines references, call hierarchy, and implementations to estimate the impact of changing a symbol at the given position. SYM-09: Comprehensive blast radius analysis with deduplication.

type BlastRadiusArgs

type BlastRadiusArgs struct {
	Path string `json:"path" jsonschema:"File path"`
	Line int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col  int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
}

BlastRadiusArgs is the input schema for the analyze_blast_radius tool.

type CallHierarchyArgs

type CallHierarchyArgs struct {
	Path      string `json:"path" jsonschema:"File path"`
	Line      int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col       int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
	Direction string `json:"direction,omitempty" jsonschema:"incoming, outgoing, or both (default: both)"`
}

CallHierarchyArgs is the input schema for the get_call_hierarchy tool.

type FindImplementationsArgs

type FindImplementationsArgs struct {
	Path string `json:"path" jsonschema:"File path"`
	Line int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col  int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
}

FindImplementationsArgs is the input schema for the find_implementations tool.

type FindReferencesArgs

type FindReferencesArgs struct {
	Path        string `json:"path" jsonschema:"File path"`
	Line        int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col         int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
	IncludeDecl bool   `json:"include_declaration,omitempty" jsonschema:"Include the declaration itself in results"`
}

FindReferencesArgs is the input schema for the find_references tool.

type GoToDefinitionArgs

type GoToDefinitionArgs struct {
	Path string `json:"path" jsonschema:"File path"`
	Line int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col  int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
}

GoToDefinitionArgs is the input schema for the go_to_definition tool.

type HierarchyNode

type HierarchyNode struct {
	Name     string
	Kind     string
	URI      string
	Range    gen.Range
	Children []HierarchyNode
}

HierarchyNode represents a node in a call or type hierarchy tree.

func GetCallHierarchy

func GetCallHierarchy(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int, direction string) ([]HierarchyNode, error)

GetCallHierarchy retrieves the call hierarchy for the symbol at the given position. SYM-07: Three-step protocol: prepare, then incoming/outgoing calls, recursed up to depth limit. direction: "incoming", "outgoing", or "both".

func GetTypeHierarchy

func GetTypeHierarchy(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int, direction string) ([]HierarchyNode, error)

GetTypeHierarchy retrieves the type hierarchy for the symbol at the given position. SYM-08: Three-step protocol: prepare, then subtypes/supertypes, recursed up to depth limit. direction: "subtypes", "supertypes", or "both".

type HoverArgs

type HoverArgs struct {
	Path string `json:"path" jsonschema:"File path"`
	Line int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col  int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
}

HoverArgs is the input schema for the get_hover_info tool.

type HoverResult

type HoverResult struct {
	Content  string // markdown content
	Language string // language ID for code blocks (best-effort)
}

HoverResult holds formatted hover/type information.

func GetHover

func GetHover(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int) (*HoverResult, error)

GetHover sends textDocument/hover and returns formatted hover content. SYM-05: Get type/documentation information for the symbol at the given position.

type SearchSymbolsArgs

type SearchSymbolsArgs struct {
	Query string `json:"query" jsonschema:"Symbol name or pattern to search"`
}

SearchSymbolsArgs is the input schema for the search_symbols tool.

type SymbolLocation

type SymbolLocation struct {
	URI     string
	Range   gen.Range
	Preview string // the line of code at this location (best-effort)
	Name    string // optional symbol name (for workspace search results)
	Kind    string // optional symbol kind name
}

SymbolLocation represents a code location with a preview line.

func FindImplementations

func FindImplementations(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int) ([]SymbolLocation, error)

FindImplementations sends textDocument/implementation and returns locations. SYM-06: Find all implementations of an interface or abstract method.

func FindReferences

func FindReferences(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int, includeDecl bool) ([]SymbolLocation, error)

FindReferences sends textDocument/references and returns all reference locations. SYM-02: Find all references to the symbol at the given position.

func GoToDefinition

func GoToDefinition(ctx context.Context, lease *lspool.WorkerLease, uri string, line, col int) ([]SymbolLocation, error)

GoToDefinition sends textDocument/definition and returns location(s). SYM-01: Navigate to the definition of a symbol at line:col in the given file URI.

func SearchSymbols

func SearchSymbols(ctx context.Context, lease *lspool.WorkerLease, query string) ([]SymbolLocation, error)

SearchSymbols sends workspace/symbol and returns matching symbol locations. SYM-04: Search for symbols across the workspace by name pattern.

type SymbolOutline

type SymbolOutline struct {
	Name           string
	Kind           string
	Range          gen.Range
	SelectionRange gen.Range // The identifier range (for cursor positioning in references/rename).
	Children       []SymbolOutline
}

SymbolOutline represents a symbol in the document outline tree.

func GetSymbolOverview

func GetSymbolOverview(ctx context.Context, lease *lspool.WorkerLease, uri string) ([]SymbolOutline, error)

GetSymbolOverview sends textDocument/documentSymbol and returns a hierarchical outline. SYM-03: Get a structured outline of all symbols in a file, preserving hierarchy.

type SymbolOverviewArgs

type SymbolOverviewArgs struct {
	Path string `json:"path" jsonschema:"File path for symbol outline"`
}

SymbolOverviewArgs is the input schema for the get_symbol_overview tool.

type SymbolRetrievalSkill

type SymbolRetrievalSkill struct{}

SymbolRetrievalSkill is a ToolProvider adapter that exposes the 9 symbol retrieval tools through the skill interface for daemon discovery.

func (*SymbolRetrievalSkill) Description

func (s *SymbolRetrievalSkill) Description() string

Description returns a human-readable description of this skill.

func (*SymbolRetrievalSkill) Init

func (s *SymbolRetrievalSkill) Init(deps skill.SkillDeps) error

Init is a no-op; kernel tools get their dependencies from the daemon, not SkillDeps.

func (*SymbolRetrievalSkill) Name

func (s *SymbolRetrievalSkill) Name() string

Name returns the unique skill identifier.

func (*SymbolRetrievalSkill) Tools

func (s *SymbolRetrievalSkill) Tools() []*mcp.ToolDef

Tools returns the 9 ToolDefs for symbol retrieval. RegisterFn is nil because the daemon owns MCP registration (D-01).

type TypeHierarchyArgs

type TypeHierarchyArgs struct {
	Path      string `json:"path" jsonschema:"File path"`
	Line      int    `json:"line" jsonschema:"Line number (1-indexed, matches editor display)"`
	Col       int    `json:"column" jsonschema:"Column number (1-indexed, matches editor display)"`
	Direction string `json:"direction,omitempty" jsonschema:"subtypes, supertypes, or both (default: both)"`
}

TypeHierarchyArgs is the input schema for the get_type_hierarchy tool.

Jump to

Keyboard shortcuts

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