Skip to main content
Glama

code_method

Read-onlyIdempotent

Fetch complete source of methods, constructors, properties, or local functions with real line numbers to inspect implementations and edit specific lines directly. Supports batch retrieval of multiple members.

Instructions

PREFERRED METHOD: Fetches the complete source of method(s) (also constructors, properties, module-level functions, the local functions of a TypeScript or JavaScript function such as a React component's handlers, and other members) with line numbers. Returns: kind, class or declaring function, namespace, line range, return type, modifiers, doc summary (XML comment, docstring or JSDoc) and the full body including attributes or decorators. A member too large for one answer (a big React component) comes back as a map instead: its local members with line ranges and its opening lines; fetch the parts you need by name. BATCH MODE: pass 'Method1,Method2,Method3' (comma-separated, NO SPACES) to fetch several members in one call. Overloads of the same name are all returned. Use AFTER code_outline to drill into specific members; to find a member whose file you do not know use code_search first. For a whole small file or a non-code file use code_read. CRITICAL: the line numbers are the real file lines, so they can be used directly with file_edit_lines.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "workspace": "<workspace>",
      "relativeFilePath": "<relativeFilePath>",
      "methodName": "<methodName>"
    },
    "name": "code_method"
  }
}

Input Schema

NameRequiredDescriptionDefault
guideNotrue: put the code guide first in the result. Use on your first code call, or when told it changed.
classNameNoOptional: class name when the file has several classes with the same member name; in TypeScript and JavaScript also the name of the function (component, hook) that declares a local member
workspaceYesWorkspace name as shown in Waymark (a single workspace; '*' is not accepted)
methodNameYesMember name(s) to fetch. Single: 'GetUsers' | Batch: 'GetUsers,UpdateUser,DeleteUser' (NO SPACES)
relativeFilePathYesPath of the source file relative to the workspace root (e.g. 'Services/UserService.cs', 'app/services/user.py' or 'src/components/TradeTable.tsx')

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnly/idempotent/non-destructive annotations, it discloses the full return shape (kind, declaring class, namespace, line range, return type, modifiers, doc summary, body with decorators), the fallback behavior when a member is too large (a map of local members plus opening lines), the overload rule, and the critical fact that line numbers align with real file lines for use with file_edit_lines. No annotation contradiction.

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?

Front-loaded with the key action and return contract, with capped headers (BATCH MODE, CRITICAL) that aid scanning. Slightly verbose in the member-kind enumeration and minor duplication of the batch-format rule already in the schema, but nearly every sentence carries actionable information.

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 5-parameter read tool with no output schema, the description covers what is returned, the oversized-member edge case, overload handling, and the interaction with file_edit_lines. Nothing an agent needs to invoke or interpret the result is missing.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description adds behavioral meaning to methodName: batch mode is comma-separated with NO SPACES, all overloads of the same name are returned, and the large-member map requires fetching parts by name. These details affect how an agent fills the parameter even though batching is partly echoed in the schema.

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 concrete verb and resource ("Fetches the complete source of method(s)... with line numbers") and enumerates the member kinds covered, including constructors, properties, module-level functions and TS/JS local functions. Explicitly distinguishes itself from code_outline, code_search and code_read, so an agent can separate it from siblings without opening a schema.

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

Usage Guidelines5/5

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

Gives an explicit workflow: use AFTER code_outline to drill into members, use code_search when the file is unknown, and use code_read for a whole small or non-code file. Both when-to-use and when-not-to-use alternatives are named.

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