Skip to main content
Glama

prepare-staging

Destructive

Prepares a target staging folder for restore, selects backup files from the source, and identifies which files still need copying. Supports plan-only and dry-run checks.

Instructions

dbabrain common.cli prepare-staging: A restore's staging folder to make ready for a backup directory's files, and the question of which still have to travel. Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line. Request fields (pass them as request):

  • source: The source host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...

  • source_dir: The backup directory on the source host.

  • target: The target host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...

  • target_dir: The staging directory on the target host - on a windows login a drive path (C:/dbabrain_restore/<restore_id>, either separator); a drive path on any other login is refused.

  • chain: Read the chain from the source: {db_type (postgresql | oracle | sqlserver), backup_dir (oracle: the path RMAN's catalog names), container (oracle: where RMAN runs), point_in_time (set: the chain that reaches the momen...

  • include: Path prefixes the restore needs; empty = everything. Stated, it is used as it is; absent, chain reads it from the source.

  • window_hours: Also copy every file the source wrote in the last N hours, beside the include - copy_selection window. Ignored when include is empty (everything is copied).

  • make_readable: When something under source_dir is not readable by the login: sudo -n chmod -R a+rX on it first (a live archivelog job writes 0640). Never asks for a password - where sudo needs one it is refused at once and the listi...

  • space_check: The room the files still to copy must find on the target before the first one moves: free >= bytes x factor. A restore entry's own space_check, handed on by the app; the same object, the same defaults.

  • staging_marker: The name of the file that marks target_dir as this tool's staging folder: only a marked folder is mirrored, and an unmarked one that shares no file with the source is refused. A restore entry's own staging_marker, han...

  • replace: Relative paths that travel even when the target holds them at the same size and not older: a copy the caller's checksum gate found different.

  • plan_only: true: answer only the files the request selects (and the chain, when asked), read from the source; the target is not opened and nothing is prepared.

  • incoming: Instead of a source (0.39.0): the files the caller already knows, relative to target_dir with their sizes - the target half alone: the folder made, marked and proven writable, the room for the files not there yet at t...

  • dry_run: With incoming (0.39.0): read only - whether target_dir is there and whose, which files are there already, and whether the rest fit, each a verdict; nothing is made or written. Refused without incoming.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "prepare-staging"
  }
}

Input Schema

NameRequiredDescriptionDefault
requestNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations only say readOnly=false and destructive=true; the description adds real context beyond that: 'Changes or removes something', the emergency-operations requirement for confirm: "yes" plus a reason, refusal rules (unmarked staging folders, sudo requiring a password, drive paths on non-Windows logins), and the space_check/readability side effects. It falls short of 5 only because consequences of destructive failure and rollback behavior remain unstated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The bulleted request-field list is a usable structure, but the opening purpose sentence is awkwardly phrased and several entries are truncated mid-clause ('windo...', 'momen...', 'listi...'), leaving fragments that read as broken rather than concise.

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

Completeness4/5

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

For a destructive, open-world operation with an output schema (so return values need not be documented), the description covers the confirmation/authorization path, the mode switches, and the refusal conditions an agent must anticipate. The truncated parameter explanations are the remaining gap.

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?

Schema coverage is 0% – the whole API is one opaque 'request' object – so the description carries the full burden and does enumerate each request field with meaningful semantics (chain, include vs window_hours, staging_marker, replace, incoming vs dry_run). Several field explanations are cut off with ellipses, so the coverage is substantial but incomplete.

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 first sentence names the resource (a restore's staging folder on the target) and the action (make it ready for the backup directory's files, and determine which files still have to travel). It is convoluted ('the question of which still have to travel') and never distinguishes this from the sibling finish-staging, but the resource and effect are identifiable.

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

Usage Guidelines3/5

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

The description documents operating modes (plan_only, incoming, dry_run) that implicitly tell the agent which shape of request to send, and it notes that incoming replaces a source. But it never states when to call this versus finish-staging or copy-files, and no prerequisites for the overall workflow are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools