Skip to main content
Glama
semwalajay83-sem

salesforce-metadata-mcp

Scan Apex for Anti-Patterns

sf_scan_apex_antipatterns
Read-onlyIdempotent

Scan Apex classes to identify anti-patterns, including SOQL/DML in loops, hardcoded IDs, and debug statements, before deployment to prevent performance and quality issues.

Instructions

Scans Apex classes in the org for common anti-patterns using the Tooling API. Detects SOQL/DML in loops, hardcoded Salesforce IDs, and debug statements left in production code. Use before deploying to catch performance and quality issues early.

classNames: optional list of class names to scan (omits test classes with __Test suffix) maxClasses: maximum classes to scan (default 20, max 200)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
classNamesNoApex class names to scan (omit to scan all)
maxClassesNoMaximum number of classes to scan
Behavior4/5

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

Annotations already declare read-only and idempotent behavior. The description adds valuable context: uses the Tooling API, lists concrete anti-patterns detected, notes that test classes with __Test suffix are omitted, and includes class count limits. This goes beyond the annotations without contradicting them.

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 and well-structured: opening sentence states the purpose, second sentence lists what is detected, third provides usage guidance, and parameter details follow. Every sentence contributes value; no filler or redundancy.

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 scanning tool with 2 parameters, no output schema, and clear annotations, the description covers purpose, detections, use case, and parameter behavior. It omits what the output format looks like, which would be useful given no output schema, but it is otherwise complete for most agent needs.

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 covers both parameters at 100%, providing a baseline of 3. The description adds a meaningful clarification by noting that classNames 'omits test classes with __Test suffix,' which is not present in the schema. This extra semantic detail raises the score to 4.

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 clearly identifies the tool as scanning Apex classes for common anti-patterns, listing specific examples (SOQL/DML in loops, hardcoded IDs, debug statements). However, it does not explicitly differentiate from similar siblings like sf_run_code_scanner, so it stops short of a 5.

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 a clear usage context: 'Use before deploying to catch performance and quality issues early.' This is helpful but does not mention alternatives or when not to use the tool, so it lacks the explicit exclusions/alternatives that would merit a 5.

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/semwalajay83-sem/salesforce-metadata-mcp'

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