Skip to main content
Glama

find_catch_blocks

Find all catch blocks that handle a specific exception type in Java. Use it to analyze exception handling patterns or locate handlers for refactoring.

Instructions

Find all catch blocks for an exception type (catch(ExceptionType e)).

JDT-UNIQUE: This fine-grained search is not available in LSP.

USAGE: Provide fully qualified exception type name as typeName OUTPUT: All catch blocks that handle this exception type

Useful for:

  • Understanding exception handling patterns

  • Finding all handlers for a specific exception

  • Exception handling analysis and refactoring

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
typeNameYesFully qualified exception type name (e.g., 'java.io.IOException')
maxResultsNoMaximum results to return (default 100)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.4
  2. Removedv1.3.3
  3. First observedv1.2.0

TDQS

A3.9/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 burden and largely succeeds: it discloses the JDT-unique nature, the output shape, the load_project precondition, and a nuanced explanation of potentialMatches (unconfirmed matches, counted/listed separately). It does not cover result truncation behavior or performance limits, so a small gap remains.

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?

Core purpose is front-loaded, and labeled sections (USAGE, OUTPUT, Useful for) make it scannable. The 'Useful for' bullets are somewhat redundant with the opening sentence, and the potentialMatches paragraph is dense, but nothing is off-topic.

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 and no annotations, the description compensates by explaining the return content and the special potentialMatches field, plus the load_project prerequisite. It is largely complete for a read-only search tool, missing only edge details like result capping behavior.

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% for both parameters, so the schema already documents typeName and maxResults with examples and defaults. The description's 'USAGE' line re-states the typeName format but adds no syntax or constraint detail beyond the schema, so the baseline of 3 applies.

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 states a specific verb and resource ('Find all catch blocks for an exception type') and clarifies scope with the '(catch(ExceptionType e))' signature form. It is unmistakable what the tool does, though it never names a sibling (e.g. find_throws_declarations) to distinguish itself.

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?

It gives a prerequisite ('Requires load_project to be called first') and a concrete usage instruction ('Provide fully qualified exception type name as typeName'), plus a list of intended scenarios. It stops short of explicit when-not-to-use or alternative-tool routing, so it misses the top tier.

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