Skip to main content
Glama
semwalajay83-sem

salesforce-metadata-mcp

Run Code Analyzer (PMD/ESLint/RetireJS/SFGE)

sf_run_code_scanner
Read-onlyIdempotent

Detect code quality and security issues in Apex classes using Salesforce Code Analyzer, including static analysis from PMD, SFGE, and ESLint engines.

Instructions

Runs Salesforce Code Analyzer against Apex classes in the org — a real multi-engine static analysis scan (PMD rules including ApexCRUDViolation and OperationWithLimitsInLoop, SFGE data-flow analysis for SOQL injection, RetireJS for vulnerable JS libraries, ESLint, and Salesforce's regex engine), on top of the lighter-weight sf_scan_apex_antipatterns heuristic check. Retrieves class bodies via the Tooling API into a temp workspace, runs the scanner, and cleans up afterward. PMD/CPD/SFGE engines require Java 11+ on the host running this MCP server — if Java isn't detected, the scan automatically falls back to the Java-free engines (eslint, retire-js, regex, flow) and flags this in the response rather than failing.

classNames: optional list of class names to scan (omit to scan all active classes) maxClasses: maximum classes to scan (default 20, max 200) ruleSelector: optional override, e.g. ['pmd:Security'] — defaults to 'Recommended' rules (auto-restricted per the Java note above)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
classNamesNoApex class names to scan (omit to scan all active classes)
maxClassesNoMaximum number of classes to scan
ruleSelectorNoOverride rule selectors, e.g. ['pmd:Security', 'eslint:Recommended']. Defaults to 'Recommended' rules, auto-restricted to non-Java engines (eslint, retire-js, regex, flow) if Java isn't detected on the host.
Behavior5/5

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

While annotations already declare read-only and idempotent, the description adds substantial behavioral detail: it retrieves class bodies via Tooling API, creates a temp workspace, cleans up afterward, requires Java 11 for certain engines, and automatically falls back to Java-free engines with a response flag. This goes far beyond the annotation hints.

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 information-dense and front-loaded with the core purpose, but the first sentence is quite long with a parenthetical list of engines and rules. The param descriptions are concise and add value, but the overall length is higher than strictly necessary though each sentence carries meaningful detail.

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?

The description covers the multi-engine nature, Java dependency, fallback behavior, and lifecycle (fetch, scan, cleanup). It does not detail the exact output format or return schema, but it does mention response flags for fallback. Given no output schema, a bit more about the scan results could improve completeness, but it is largely adequate for a complex tool.

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%, and both the schema and description explain classNames, maxClasses, and ruleSelector defaults. The description adds little beyond the schema, mainly reiterating defaults and the Java fallback context. Baseline 3 is appropriate given the schema does the heavy lifting.

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 identifies the tool as running Salesforce Code Analyzer against Apex classes, listing specific engines and rules. It distinguishes itself from the sibling sf_scan_apex_antipatterns by framing itself as a real multi-engine scan on top of the lighter heuristic check.

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 positions the tool relative to sf_scan_apex_antipatterns, implying deeper analysis. It explains the Java-dependent engine fallback behavior, giving clear context for when certain features are unavailable. However, it does not explicitly state 'use this when X, use antipatterns when Y'.

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