Skip to main content
Glama

check_syntax

Validate Ansible playbook syntax before execution to identify configuration errors and ensure proper formatting.

Instructions

Check syntax of an Ansible playbook without executing it

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playbookYes

Implementation Reference

  • The handler function for the check_syntax tool. It validates the playbook path, runs `ansible-playbook --syntax-check`, captures output, and throws AnsibleExecutionError on failure.
    export async function checkSyntax(options: CheckSyntaxOptions): Promise<string> {
      const playbookPath = validatePlaybookPath(options.playbook);
      
      // Build command with syntax-check option
      const command = `ansible-playbook ${playbookPath} --syntax-check`;
    
      try {
        // Execute command
        const { stdout, stderr } = await execAsync(command);
        return stdout || 'Syntax check passed (no issues found)';
      } catch (error) {
        // Handle exec error - in this case, a syntax error
        const execError = error as { stderr?: string; message: string };
        throw new AnsibleExecutionError(
          `Syntax error: ${execError.message}`,
          execError.stderr
        );
      }
    }
  • Zod schema defining the input for check_syntax: requires 'playbook' path string.
    export const CheckSyntaxSchema = z.object({
      playbook: z.string().min(1, 'Playbook path is required'),
    });
    
    export type CheckSyntaxOptions = z.infer<typeof CheckSyntaxSchema>;
  • Registration of the 'check_syntax' tool in the toolDefinitions map, linking schema and handler.
    check_syntax: {
      description: 'Check syntax of an Ansible playbook without executing it',
      schema: CheckSyntaxSchema,
      handler: playbooks.checkSyntax,
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool performs syntax checking without execution, which is useful, but doesn't mention error handling, output format, validation scope (e.g., YAML syntax vs. Ansible semantics), or any limitations like file size constraints. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence that front-loads the core purpose with zero wasted words. Every element ('check syntax', 'Ansible playbook', 'without executing it') earns its place by clarifying the tool's function and scope.

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 moderate complexity (syntax validation), no annotations, no output schema, and low schema coverage, the description is minimally adequate. It covers the basic purpose but lacks details on behavior, parameters, and results, leaving the agent to infer or test these aspects. It meets the minimum viable threshold but has clear gaps.

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 0%, so the description must compensate. It implies the 'playbook' parameter is the content to check, but doesn't specify format (e.g., raw YAML string, file path), expected structure, or examples. The description adds minimal value beyond the schema's parameter name, resulting in a baseline score.

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 specific verb ('check syntax') and resource ('Ansible playbook'), with explicit differentiation from execution ('without executing it'). It distinguishes from sibling tools like 'run_playbook' by focusing on validation rather than execution.

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 context for when to use this tool ('check syntax... without executing it'), implying it's for validation before running. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the siblings, though the contrast with 'run_playbook' is evident.

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/tarnover/mcp-sysoperator'

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