Skip to main content
Glama
Majrooo

majrooo-mcp-devkit

by Majrooo

extract_code_block

Read-onlyIdempotent

Extract a function, struct, class, or method from source code and return its exact line range and content, including annotations and doc comments while ignoring braces in strings or comments.

Instructions

Read the full text of a function, struct, class, or method from a file. Returns precise line range + content. Includes leading annotations (#[derive], @decorator, /// doc comments). String/comment-aware bracket matching prevents false depth counts from braces inside strings or comments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking directory for resolving relative file paths (default: primary project root)
fileYesSource file path (absolute or relative to cwd)
symbolYesSymbol name to extract
contextLinesNoExtra lines before/after the block (default: 0)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), yet the description adds real behavioral detail beyond them: it returns a precise line range plus content, it includes leading annotations and doc comments, and it uses string/comment-aware bracket matching to avoid false depth counts from braces inside literals. That is substantive context the annotations do not provide.

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?

Three tight sentences with no filler: the core action is front-loaded, followed by the return shape and then the extraction-safety note. Every sentence carries distinct information.

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?

With no output schema, the description correctly steps in to describe the return value (line range + content) and the extraction semantics (annotation inclusion, bracket matching). It stops short of covering failure behavior, such as what happens when the symbol is not found or is ambiguous, which is the main remaining gap for a tool with a required symbol lookup.

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 description coverage is 100%, so all four parameters (cwd, file, symbol, contextLines) are already documented in the schema and the baseline is 3. The description adds no parameter-level detail, though 'Includes leading annotations' implicitly relates to how extraction boundaries are computed rather than to any parameter.

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

Purpose4/5

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

The description gives a specific verb and resource: 'Read the full text of a function, struct, class, or method from a file,' which is far more precise than a generic 'read file' tool. It does not explicitly name or contrast with siblings like universal_find_references or split_file_by_declarations, so the agent must infer the boundary, but the symbol-level extraction purpose is unambiguous.

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

Usage Guidelines3/5

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

Usage is implied by the phrasing (you call it to obtain the full body of a named symbol), but there is no explicit when-to-use/when-not or reference to alternatives such as find_references or split_file_by_declarations. An agent can infer the context but gets no routing guidance.

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