Skip to main content
Glama

list_tasks

Generate a detailed list of tasks to be executed by a specified playbook, enabling users to preview and manage infrastructure operations effectively.

Instructions

List all tasks that would be executed by a playbook

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 `listTasks` that validates the playbook path and executes `ansible-playbook --list-tasks` to list all tasks in the playbook, returning the stdout or an error.
    export async function listTasks(options: ListTasksOptions): Promise<string> { const playbookPath = validatePlaybookPath(options.playbook); // Build command with list-tasks option const command = `ansible-playbook ${playbookPath} --list-tasks`; try { // Execute command const { stdout, stderr } = await execAsync(command); return stdout || 'No tasks found in playbook'; } catch (error) { // Handle exec error const execError = error as { stderr?: string; message: string }; throw new AnsibleExecutionError( `Error listing tasks: ${execError.message}`, execError.stderr ); } }
  • Zod schema `ListTasksSchema` for input validation, requiring a `playbook` path string.
    export const ListTasksSchema = z.object({ playbook: z.string().min(1, 'Playbook path is required'), }); export type ListTasksOptions = z.infer<typeof ListTasksSchema>;
  • Registration of the `list_tasks` tool in the `toolDefinitions` object, linking its description, input schema, and handler function.
    list_tasks: { description: 'List all tasks that would be executed by a playbook', schema: ListTasksSchema, handler: playbooks.listTasks, },

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