Skip to main content
Glama

find_field_writes

Locate every write access to a Java field and list where its value is changed, helping analyze state mutations and data flow. Requires loading the project first.

Instructions

Find all write accesses (mutations) to a field.

USAGE: Position cursor on a field declaration or reference OUTPUT: List of locations where the field is modified

IMPORTANT: Uses ZERO-BASED coordinates.

Unlike find_references which returns all usages, this returns only locations where the field value is changed (assignments, increments, etc). Useful for data flow analysis and understanding state mutations.

maxResults outside 0 to 1000 is INVALID_PARAMETER.

potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.

Requires load_project to be called first.

Input Schema

NameRequiredDescriptionDefault
lineYesZero-based line number
columnYesZero-based column number
filePathYesPath to source file
maxResultsNoMax write locations to return, 0 to 1000 (default 100)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.5.3
    • changedInput schema / properties / maxResults / description
      Previous value: -"Max write locations to return (default 100)"New value: +"Max write locations to return, 0 to 1000 (default 100)"
  2. Addedv1.3.4
  3. Removedv1.3.3
  4. First observedv1.2.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and does so well: it documents the zero-based coordinate convention, the INVALID_PARAMETER failure mode for out-of-range maxResults, and the unconfirmed-match semantics. It stops short of describing result ordering or whether the declaration site is included, which keeps it from a 5.

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?

Well-structured with USAGE/OUTPUT/IMPORTANT labels and the core purpose front-loaded. The potentialMatches paragraph is dense and worth its length since no output schema exists, though the definition is on the longer side.

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?

No output schema exists and no annotations are present, yet the description covers the return shape ('List of locations'), the conditional potentialMatches field with its count/locations substructure, prerequisites, and error semantics. It is complete for a position-based search tool of this complexity.

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 the baseline is 3, but the description adds genuine meaning beyond the schema: it re-emphasizes zero-based coordinates, states the maxResults valid range and the exact error for violations, and describes the potentialMatches structure that the schema does not cover.

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?

Opens with a specific verb+resource ('Find all write accesses (mutations) to a field') and explicitly contrasts itself with the sibling find_references ('this returns only locations where the field value is changed'). An agent can distinguish it from the reference-finding tools 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 precondition ('Position cursor on a field declaration or reference'), a dependency ('Requires load_project to be called first'), an alternative and the condition selecting it ('Unlike find_references which returns all usages'), and motivation ('useful for data flow analysis'). Nothing needed for correct invocation is left to inference.

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