Skip to main content
Glama
hareeshbounteous

GitHub Code MCP

get_code_fragment

Extract a named class, method, or constructor body from a Java file using AST-accurate parsing, with fallback to regex or context window.

Instructions

Extract one named class/method/constructor body from a Java file.

Uses AST-accurate parsing when tree-sitter-java is installed, else a regex-based heuristic; falls back to a plain text-context window (match_type="context_window") if the symbol isn't a recognisable Java declaration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNo
pathYes
repoNo
ownerNo
symbolYes
Behavior3/5

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

The description discloses the AST-based vs regex-based vs context-window fallback behavior, which is valuable beyond what annotations (none) provide. However, it references a match_type parameter that is not present in the input schema, creating confusion. With no annotations, it also omits return format and error behavior.

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 two sentences, front-loaded with the purpose, and the second sentence provides technical detail without excessive length. However, the second sentence is dense and the unexpected match_type reference muddies clarity.

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

Completeness2/5

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

The tool has 5 parameters and no output schema, yet the description covers only the basic extraction mode and leaves repo/owner/ref semantics, return type, and failure behavior undefined. Standalone, an agent would struggle to invoke this correctly for remote repositories.

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

Parameters2/5

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

The description adds meaning for path and symbol (the Java file and the named declaration), but repo, owner, and ref are not explained. Since schema description coverage is 0%, the description must compensate, but it does so inadequately for 3 of the 5 parameters.

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 clearly states it extracts one named class/method/constructor body from a Java file, which is a specific verb+resource. This distinguishes it from siblings like search_code (searching), get_file_contents (whole file), and list_symbols (listing symbols).

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?

The description implies usage when you need a specific named declaration body, but it does not explicitly state when to use this tool over siblings like search_code or get_file_contents. It lacks alternatives or exclusions, so only the basic context is implied.

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

Install Server

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/hareeshbounteous/github-mcp'

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