Skip to main content
Glama
tarnover
by tarnover

vault_decrypt_string

Decrypt strings encrypted with Ansible Vault by providing the string, vault ID, and password file. Simplifies secure data handling in Ansible workflows.

Instructions

Decrypt a string encrypted with Ansible Vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stringYes
vault_idNo
vault_password_fileNo

Implementation Reference

  • The main handler function that performs the decryption by creating a temp file with the encrypted string and executing 'ansible-vault decrypt'.
    export async function decryptString(options: VaultDecryptStringOptions): Promise<string> {
      let tempDir: string | undefined;
      try {
        // Create a unique temporary directory
        tempDir = await createTempDirectory('ansible-vault-decrypt');
        
        // Write the encrypted string to a temporary file
        const tempFilePath = await writeTempFile(tempDir, 'encrypted.txt', options.string);
    
        // Build the decrypt command arguments
        const args = ['decrypt', tempFilePath, '--output=-']; // Output to stdout
    
        // Add vault ID if specified
        if (options.vault_id) {
          args.splice(1, 0, `--vault-id=${options.vault_id}`); // Insert after 'decrypt'
        }
        
        // Add vault password file if specified
        if (options.vault_password_file) {
          args.splice(1, 0, `--vault-password-file=${options.vault_password_file}`); // Insert after 'decrypt'
        }
    
        const command = `ansible-vault ${args.join(' ')}`;
        console.error(`Executing: ${command}`);
    
        // Execute the command asynchronously
        const { stdout, stderr } = await execAsync(command);
        return stdout.trim();
    
      } catch (error: any) {
        // Handle execution errors
        const errorMessage = error.stderr || error.message || 'Unknown error';
        throw new AnsibleExecutionError(`Error decrypting string: ${errorMessage}`, error.stderr);
      } finally {
        // Ensure cleanup happens even if errors occur
        if (tempDir) {
          await cleanupTempDirectory(tempDir);
        }
      }
    }
  • Zod schema defining the input parameters for the vault_decrypt_string tool: encrypted string, optional vault_id, and vault_password_file.
    export const VaultDecryptStringSchema = z.object({
      string: z.string().min(1, 'Encrypted string is required'),
      vault_id: z.string().optional(),
      vault_password_file: z.string().optional(),
    });
    
    export type VaultDecryptStringOptions = z.infer<typeof VaultDecryptStringSchema>;
  • Registers the 'vault_decrypt_string' tool in the toolDefinitions map, linking its description, input schema, and handler function.
    vault_decrypt_string: {
      description: 'Decrypt a string encrypted with Ansible Vault',
      schema: VaultDecryptStringSchema,
      handler: vault.decryptString,
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('decrypt') but doesn't describe what happens on success (e.g., returns plaintext), failure modes, authentication needs (implied by vault parameters), or side effects. This is inadequate for a tool with parameters and no annotation coverage.

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 waste, front-loading the core purpose. It's appropriately sized for a straightforward tool, making every word count without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema coverage, no output schema, and three parameters, the description is incomplete. It doesn't cover parameter meanings, return values, or behavioral details, leaving significant gaps for a decryption tool that likely involves security-sensitive operations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/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 for undocumented parameters. It mentions 'encrypted with Ansible Vault' for the 'string' parameter but doesn't explain 'vault_id' or 'vault_password_file', leaving two of three parameters without semantic context. The description adds minimal value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('decrypt') and resource ('a string encrypted with Ansible Vault'), providing a specific purpose. However, it doesn't explicitly distinguish from its sibling 'vault_encrypt_string' beyond the obvious encryption/decryption distinction, missing nuanced differentiation.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives or in what context. The description lacks any mention of prerequisites, such as having an encrypted string from Ansible Vault, or exclusions, leaving usage entirely implied.

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