Skip to main content
Glama

find_guards

Retrieves conditional guards protecting a code node, showing what conditions must be true for execution.

Instructions

Find conditional guards protecting a node.

Returns all SCOPE nodes that guard the given node, walking from inner to outer scope. Useful for answering "what conditions must be true for this code to execute?"

Each guard includes:

  • scopeId: The SCOPE node ID

  • scopeType: Type of conditional (if_statement, else_statement, etc.)

  • condition: Raw condition text (e.g., "user !== null")

  • constraints: Parsed constraints (if available)

  • file/line: Location in source

Example use cases:

  • "What conditions guard this API call?"

  • "Is this code protected by a null check?"

  • "What's the full guard chain for this function call?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesID of the node to find guards for (e.g., CALL, VARIABLE)
Behavior4/5

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

No annotations are provided, so the description carries full burden. It explains the behavior (walking from inner to outer scope) and the output fields (scopeId, scopeType, condition, constraints, file/line). It does not mention authorization or side effects, but for a read-only query tool, the transparency is adequate.

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 concise (about 10 lines) and well-structured: a one-line summary, a sentence on scope walking, bullet points for returned fields, and three example questions. No redundant sentences.

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 the tool has one parameter and no output schema, the description fully covers what the tool does, how it works, what it returns, and typical use cases. An agent can confidently invoke it.

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?

The schema has one parameter (nodeId) with a basic description. The tool description adds meaning by explaining the parameter's role in context and giving examples ('e.g., CALL, VARIABLE'). Since schema coverage is 100%, the description adds value 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 explicitly states 'Find conditional guards protecting a node' with a clear verb and resource. It distinguishes from sibling tools like 'find_calls' and 'find_nodes' by focusing on guard conditions.

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 provides concrete use cases (e.g., 'What conditions guard this API call?') and a helpful question ('what conditions must be true for this code to execute?'). However, it does not explicitly state when not to use this tool or compare to alternatives, but the context is sufficiently clear.

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/Disentinel/grafema'

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