Skip to main content
Glama

shellcheck

Lint shell scripts to detect bugs, stylistic problems, and potential errors. Supports multiple shells and outputs structured JSON with severity levels.

Instructions

Run ShellCheck on a shell script to find bugs, stylistic issues, and potential errors. Use when: reviewing shell scripts, validating CI pipeline scripts, or debugging script errors. Prefer over: manual bash syntax inspection when you want automated rule-based analysis (300+ rules). Avoid when: checking many large scripts — run ShellCheck locally for bulk analysis.

Supported shells: bash, sh, dash, ksh, ash

Returns structured JSON with issue details including line, column, code, message, and severity.

Common error codes:

  • SC1090: Can't follow non-constant source

  • SC2148: Tips depend on target shell and yours is unknown

  • SC2086: Double quote to prevent globbing

  • SC2164: Use cd with || exit

  • SC2006: Use $(...) instead of legacy backticks

  • SC2029: Note that, unlike in BASH, a variable cannot contain a newline

  • SC2230: Which is redundant

  • SC2068: Double quote array subscript

  • SC2196: Several way to test global flag

  • SC2001: See if you can use ${var//search/replace}

  • SC2162: read without -r will mangle backslashes

  • SC2129: Style: Consider using { cmd1; cmd2; } >> file instead of individual redirects

Use exclude parameter to suppress warnings (e.g., "SC1090,SC2148"). Use severity parameter to filter by minimum severity (error, warning, info, style).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shellNoShell type to checkbash
excludeNoComma-separated list of warning codes to exclude (e.g., 'SC1090,SC2148')
severityNoMinimum severity to report
file_pathNoPath to the shell script file to check
enable_allNoEnable all optional checks
check_sourcedNoEnable checks for sourced files
script_contentNoRaw shell script content to check (alternative to file_path)
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses return format (structured JSON with line/column/code/message/severity) and lists common error codes. Implicitly non-destructive but could explicitly state read-only 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?

Well-structured with clear sections (purpose, usage, supported shells, returns, common codes). The list of error codes is verbose but helpful. Front-loaded with critical info.

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 7-param tool with no output schema or annotations, the description covers purpose, usage, parameter guidance, and output format. Lacks detailed output structure but adequate for standard linter output. Sibling tool not referenced but not necessary.

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?

Schema covers all 7 params (100% coverage). Description adds value by explaining exclude/suppression, severity filtering, and listing common error codes. Enhances understanding beyond schema descriptions.

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 the tool runs ShellCheck on shell scripts to find bugs, stylistic issues, and potential errors. It distinguishes from the sibling 'shellcheck_info' by focusing on analysis execution.

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

Usage Guidelines5/5

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

Explicitly specifies when to use (reviewing scripts, validating CI, debugging), preference over manual inspection, and when to avoid (many large scripts for local bulk analysis). Provides actionable guidance.

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/Ev3lynx727/mcp-shellcheck'

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