Skip to main content
Glama

Read one definition

read_definition

Retrieve source code for a named definition from a file, returning overloads and line numbers. Enables exact-name lookup to understand code structure.

Instructions

Read the source code of one definition (method/class/function...) by exact name from a source file. Overloads and same-named definitions are all returned with line numbers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesfile path
nameYesexact definition name
languageNooverride language inference
maxLinesNocap on lines returned per definition (default 200, hard max 1000); longer bodies are truncated
Install Server

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden. It discloses the core behavior: exact-name lookup, returning all overloads/same-named definitions, and including line numbers. It does not cover error cases or return structure, but for a read operation the described behavior is substantial.

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

Conciseness5/5

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

Two information-dense sentences with no filler. The key constraints (exact name, source file, all overloads returned, line numbers) are front-loaded.

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

Completeness4/5

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

For a simple read tool with four well-documented parameters, the description covers what the tool returns and its matching behavior. It lacks an explicit note on behavior when the name is not found or the file is missing, but no output schema exists and the core contract is clear.

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

Parameters3/5

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

Schema coverage is 100%, so the parameters are already documented in the schema. The description reinforces file and exact-name lookup but does not add significant semantics beyond that baseline.

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?

States a specific verb ('Read'), a specific resource ('source code of one definition... from a source file'), and the exact-name constraint. This distinguishes it from siblings like list_definitions and go_to_definition because it returns code content rather than listings or navigation.

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 clearly signals it is for retrieving a known definition by its exact name from a file, which is actionable context. It does not explicitly name alternatives or give when-not-to-use conditions, but the exact-name requirement implies the boundary.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhaoxingxing06/kimi-tree-lens'

If you have feedback or need assistance with the MCP directory API, please join our Discord server