Skip to main content
Glama

magento_find_dataobject_issues

Identify setX(null) anti-pattern in Magento DataObject where hasX() returns true but getX() is null. Correct with unsetData().

Instructions

Detect DataObject::setX(null) anti-pattern calls. In Magento, classes extending DataObject store values in a _data array. Calling setX(null) stores the key with a null value — so hasX()/hasData('x') (which use array_key_exists) return true even though the value is null. Downstream guard conditions silently pass, but getX() returns null. The correct way to clear is unsetData('x'). Use this during field-lifecycle audits or when debugging "value persists but shouldn't" bugs. ⚡ For multi-query workflows use magento_batch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoSubdirectory to search (relative to MAGENTO_ROOT). Default: entire codebase. Example: "vendor/acme/"
maxResultsNoMaximum matches to return (default: 100, max: 500)
Behavior4/5

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

With no annotations provided, the description carries the full burden. It explains the tool's behavior (detecting setX(null) calls) and the underlying anti-pattern. It does not contradict any annotations since none exist, and it adds useful context about the data array behavior.

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?

The description is slightly verbose but well-structured, front-loading the core purpose. Every sentence adds value, though some technical detail could be condensed. It remains efficient for agent comprehension.

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 the tool's complexity (2 parameters, no output schema), the description explains the anti-pattern and usage but does not describe the output format (e.g., list of matches, code snippets). This leaves a minor gap in what the agent can expect as a result.

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%, so the schema already documents both parameters (path and maxResults) adequately. The description does not add significant meaning beyond what is in the schema, which is acceptable given baseline 3.

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 that the tool detects DataObject::setX(null) anti-pattern calls in Magento, explaining the problem and why it matters. It distinguishes itself from sibling tools by focusing on this specific anti-pattern.

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 clear usage context: during field-lifecycle audits or debugging 'value persists but shouldn't' bugs. It also mentions an alternative sibling tool (magento_batch) for multi-query workflows, though it doesn't explicitly state when not to use this tool.

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/krejcif/magector'

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