Skip to main content
Glama
Flux-Frontiers

SwiftKG MCP Server

find_definition_at

Identify the code definition at any file location and get an explanation of that symbol, using just file path and line number.

Instructions

Find the code node whose definition spans a given file location.

Reverse-resolves a (file, line) pair to a graph node ID and returns the same Markdown report as explain(). Useful when reading a file in an IDE and wanting to understand the symbol at a specific line without constructing a node ID manually.

Matches the innermost (most-specific) function, method, type, extension, type alias, or enum whose lineno ≤ line ≤ end_lineno. Falls back to the module node when no narrower match exists.

:param file: Module path as stored in the graph, e.g. Sources/Networking/Client.swift. Leading ./ is stripped automatically. :param line: Line number (1-indexed) within the file. :return: Markdown explanation from explain(), or an informative error message if no node spans that location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes
lineYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the matching logic (innermost node by line range), fallback to module, automatic stripping of './', and the return type (Markdown or error). This adds value beyond just saying 'finds a definition' and gives the agent clear expectations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is moderately lengthy but every sentence contributes—purpose, usage context, matching algorithm, param details, and return behavior. It is well-structured with a clear opening and organized param list. Slight verbosity in the fallback explanation could be trimmed, but overall it is efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 2 parameters and no output schema shown, the description explains everything an agent needs: the exact input format with an example, the line indexing, the matching rules, fallback behavior, and the return format. There are no obvious gaps that would prevent correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully explain both parameters. It does: 'file' is described as 'Module path as stored in the graph, e.g., Sources/Networking/Client.swift' with the note about leading './' stripping, and 'line' is 'Line number (1-indexed) within the file.' This is comprehensive and compensates entirely for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Find the code node whose definition spans a given file location.' It clarifies it reverse-resolves a (file, line) pair to a node ID and returns the same report as 'explain()'. This clearly distinguishes it from siblings like get_node or find_node, which operate on node IDs or names.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear use case: 'Useful when reading a file in an IDE and wanting to understand the symbol at a specific line without constructing a node ID manually.' It implies when to use it over alternatives (e.g., when you lack a node ID) and notes the fallback to module node. It doesn't explicitly state when not to use it, but the guidance is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.