Skip to main content
Glama

find_affected_tests

Identifies test methods that cover a specified symbol in Java code, helping determine which tests to run after a change.

Instructions

Find the test methods that exercise a symbol, directly or transitively.

USAGE: find_affected_tests(filePath="path/to/File.java", line=10, column=5) OUTPUT: Test methods (JUnit 4/5, TestNG) from which the symbol is reachable, with locations - the set of tests to run after changing it.

The caller walk follows calls, instantiations, field accesses, and override declarations (a test calling through an interface or superclass covers the implementation). Non-test intermediate methods are walked through but not reported. Disabled tests are included with disabled=true (they cover the code but will not run). A symbol no test reaches returns an empty set.

Supports project methods, fields, and types as the target symbol.

Options:

  • maxResults: cap the reported list (default 100)

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesFile containing the symbol
lineYesZero-based line number
columnYesZero-based column number
maxResultsNoMaximum test methods to return (default 100)
Behavior5/5

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

With no annotations, the description fully covers behavioral traits: the caller walk mechanism, inclusion of disabled tests, handling of unreachable symbols, and support for methods, fields, types. It transparently describes what happens in various scenarios.

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?

The description is well-structured with clear sections: purpose, usage, output, details, options, prerequisite. It is concise yet comprehensive, using bullet points and plain language effectively.

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?

Given no output schema, the description thoroughly explains the output format, including disabled tests and empty sets. It covers all necessary aspects of the tool's operation, making it complete and useful.

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%, giving baseline 3. The description adds value by providing a usage example, explaining the coordinate parameters, and clarifying the maxResults option. This enhances understanding beyond 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?

The description clearly states the tool's purpose: 'Find the test methods that exercise a symbol, directly or transitively.' It provides a usage example and distinguishes itself from siblings like 'find_tests' by focusing on affected tests, not all tests.

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 includes a prerequisite ('Requires load_project to be called first') and explains the context ('the set of tests to run after changing it'). It does not explicitly state when not to use it, but it provides clear guidance for intended use.

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/pzalutski-pixel/javalens-mcp'

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