Skip to main content
Glama

find_possible_bugs

Detect possible bugs and code quality issues in Java files, including null risks, resource leaks, empty catches, and sync problems. Filter by severity after loading a project.

Instructions

Find possible bugs and code quality issues.

USAGE: find_possible_bugs() USAGE: find_possible_bugs(filePath="path/to/File.java") OUTPUT: List of potential issues

Detects:

  • Null pointer risks (dereferencing potentially null values)

  • Resource leaks (unclosed streams, connections)

  • Empty catch blocks

  • Comparison issues (== on objects instead of equals)

  • Synchronization issues (sync on String)

severity (optional, compared case-insensitively): high, medium or low keeps the issues of that severity; all (the default) keeps every issue. Any other value is rejected with INVALID_PARAMETER.

A filePath naming no source file of the project is FILE_NOT_FOUND.

Requires load_project to be called first.

Input Schema

NameRequiredDescriptionDefault
filePathNoOptional: specific file to check (default: all files)
severityNoFilter by severity, case-insensitive: high, medium, low or all (default: all)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.5.3
    • changedInput schema / properties / severity / description
      Previous value: -"Filter by severity: high, medium, low, all (default: all)"New value: +"Filter by severity, case-insensitive: high, medium, low or all (default: all)"
  2. Addedv1.3.4
  3. Removedv1.3.3
  4. First observedv1.2.0

TDQS

A4.3/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 delivers: it discloses error semantics (INVALID_PARAMETER for bad severity, FILE_NOT_FOUND for an unknown file), the default scope (all files), and the sequencing requirement (load_project first). It is silent on result granularity and runtime cost, which are secondary for a read-only analysis tool.

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 purpose, then detection categories, then parameter and error details in clearly delimited sections. The two near-duplicate USAGE lines and the OUTPUT line add slight padding, but nothing is misleading or wasted at length.

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?

For a two-param, no-output-schema, no-annotation tool, the description covers purpose, scope, prerequisites, and error paths. The main gap is that the shape of the returned issue list (file, line, message fields) is not characterized, which an agent would want before rendering results.

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 real meaning beyond the schema: severity is compared case-insensitively, 'all' is the default, and any unrecognized value is rejected with INVALID_PARAMETER. The filePath semantics (default all files, must name a project source file) are also spelled out.

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 specific verb+resource ('Find possible bugs and code quality issues') and enumerates exactly which bug classes it detects (null pointer risks, resource leaks, empty catch blocks, comparison issues, synchronization issues). This clearly separates it from siblings like validate_syntax, find_unused_code, and find_unreachable_code, which cover different concerns.

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?

Provides two concrete invocation examples (whole-project vs single file) and a hard prerequisite ('Requires load_project to be called first'). It does not explicitly name alternative tools for overlapping concerns such as syntax validation or unused-code detection, so it stops short of full when-not guidance.

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