Skip to main content
Glama

vault_decrypt_string

Decrypt Ansible Vault encrypted strings using vault ID and password file to access secure configuration data.

Instructions

Decrypt a string encrypted with Ansible Vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stringYes
vault_idNo
vault_password_fileNo

Implementation Reference

  • Implements the core logic for decrypting an Ansible Vault encrypted string using ansible-vault decrypt command, with temporary file handling and error management.
    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 (required), 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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the operation ('decrypt') but doesn't cover critical aspects like authentication needs (e.g., how vault_id or vault_password_file are used), error handling, rate limits, or what the output looks like. This is a significant gap for a tool that likely involves sensitive data and security considerations.

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 directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 the complexity of a decryption tool with security implications, no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain the return values, error conditions, or how the parameters interact, leaving too many gaps for effective use by an AI agent.

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 schema provides no parameter descriptions. The tool description mentions 'string encrypted with Ansible Vault', which hints at the 'string' parameter's purpose but doesn't explain the other two parameters (vault_id, vault_password_file) or their roles. This fails to compensate for the low coverage, leaving most parameters undocumented.

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 ('string encrypted with Ansible Vault'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from its sibling 'vault_encrypt_string' beyond the obvious inverse operation, so it doesn't fully distinguish from alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives, such as when to choose it over other decryption methods or how it relates to 'vault_encrypt_string'. There's no mention of prerequisites, context, 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

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