Skip to main content

source_location

Function source_location 

Source
pub fn source_location(
    dir: &Arc<DirGraph>,
    name: &str,
    node_type: Option<&str>,
) -> SourceLookup
Expand description

Look up the source-file location for a code-entity node.

Drives the read_code_source MCP tool’s “qualified_name → (file_path, line_number, end_line, signature)” mapping. The returned SourceLookup enum distinguishes a unique match (SourceLookup::Found) from ambiguous candidates (SourceLookup::Ambiguous with qualified-name suggestions) from a miss (SourceLookup::NotFound).

All optional fields on SourceLocation mirror the corresponding node fields. Graphs built from non-code-tree sources (e.g. a codingest-built code graph, or a manually-constructed graph) may have fewer populated.