Skip to main content
Glama
tarnover
by tarnover

check_syntax

Validate Ansible playbook syntax without execution to detect errors and ensure correct structure before deployment.

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 that runs 'ansible-playbook --syntax-check' on the specified playbook path.
    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 for check_syntax tool input, requiring a 'playbook' path string.
    export const CheckSyntaxSchema = z.object({
      playbook: z.string().min(1, 'Playbook path is required'),
    });
    
    export type CheckSyntaxOptions = z.infer<typeof CheckSyntaxSchema>;
  • Registers the check_syntax tool in the toolDefinitions object, specifying its description, schema, and handler.
    check_syntax: {
      description: 'Check syntax of an Ansible playbook without executing it',
      schema: CheckSyntaxSchema,
      handler: playbooks.checkSyntax,
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly states this is a non-execution check, which is valuable behavioral context. However, it doesn't mention error handling, output format, or any limitations like maximum playbook size or supported Ansible versions.

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 with zero wasted words. It's front-loaded with the core purpose and includes the critical constraint. Every word earns its place in this concise formulation.

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?

For a single-parameter tool with no annotations and no output schema, the description provides adequate basic context about purpose and behavior. However, it lacks details about what the check actually validates, what output to expect, or any error conditions - gaps that become more significant given the absence of structured documentation.

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?

With 0% schema description coverage and only one parameter, the description implies the parameter is an Ansible playbook content string, which adds meaningful context beyond the bare schema. However, it doesn't specify format expectations (YAML string, file path, etc.) or validation details.

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 action ('Check syntax') and resource ('Ansible playbook'), with the important constraint 'without executing it' that distinguishes it from execution tools. It's precise and unambiguous about what the tool does.

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 implies usage context - checking syntax before execution - but doesn't explicitly state when to use this tool versus alternatives like 'run_playbook' or other sibling tools. It provides clear context but lacks explicit guidance on alternatives or exclusions.

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

Related 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-ansible'

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