Skip to main content
Glama

check_syntax

Verify the syntax of an Ansible playbook before execution using MCP SysOperator, ensuring error-free and valid playbook deployment.

Instructions

Check syntax of an Ansible playbook without executing it

Input Schema

NameRequiredDescriptionDefault
playbookYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "playbook": { "minLength": 1, "type": "string" } }, "required": [ "playbook" ], "type": "object" }

Implementation Reference

  • The main handler function for the check_syntax tool. It validates the playbook path and runs `ansible-playbook --syntax-check` using execAsync.
    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 the check_syntax tool: requires a playbook path.
    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 the name to its schema and handler.
    check_syntax: { description: 'Check syntax of an Ansible playbook without executing it', schema: CheckSyntaxSchema, handler: playbooks.checkSyntax,

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