Skip to main content
Glama

Audit props copied into state

audit_props_to_state

Detects useState(props.x) initializers that cause local state to go stale when parent props change, and flags them for review across a React codebase.

Instructions

Flags useState(props.x) style initializers, the classic bug where a component's local state silently goes stale when its parent's prop changes.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "rootDir": "<rootDir>"
    },
    "name": "audit_props_to_state"
  }
}

Input Schema

NameRequiredDescriptionDefault
rootDirYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden and falls short. It never states that the tool is read-only/non-mutating (only implied by "flags"), what a result looks like (finding list, counts, file locations), or whether the scan is recursive and what it skips. For an audit tool with zero annotation coverage these are meaningful omissions.

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?

One tight sentence that front-loads the detected pattern and then justifies it with the bug it prevents. Every clause earns its place with no filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a one-parameter, single-purpose lint tool with no output schema and no annotations, the core intent is clear enough to invoke. However, the return shape and the meaning of rootDir are left entirely unspecified, which is exactly what the description needs to cover when structured fields are silent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the description never mentions the single required parameter rootDir. The name is partly self-explanatory, but nothing clarifies whether it is a project root, an absolute path, or how it bounds the scan, so the description adds no meaning beyond the bare schema.

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 uses a specific verb ("Flags") tied to a concrete code pattern ("useState(props.x) style initializers"), so the resource is unambiguous. It implicitly separates itself from broad siblings like run_full_audit by naming one narrow anti-pattern, but never states that relationship explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: the mention of "the classic bug" tells an agent this is relevant when hunting stale-state issues, but there is no explicit when-to-use, when-not-to-use, or pointer to alternatives such as run_full_audit or scan_components. The agent must infer the routing decision from the name alone.

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