{
  "name": "wait_for_text",
  "wireName": "wait_for_text",
  "source": {
    "repo": "libtmux/libtmux-rs",
    "revision": "f0e37052c232636b61d095817046e6bfc8f2ca40",
    "extractedRevision": "7a5def5921b12f58d47327cf625c039de5fa8ea7",
    "file": "crates/tmux-mcp/src/tools/observe.rs",
    "line": 344
  },
  "description": "Wait until a pane writes matching text. Reads the pane's live output stream, so text that scrolls past between checks is still seen. The returned text is that raw stream, not the rendered screen: a line redrawn in place repeats; capture_pane shows the screen. Prefer run_shell_command for commands you are sending yourself: it reports an exit status instead of guessing from output. Use this for output you did not author, such as a server logging that it is ready. A line this server itself types and submits -- with send_keys, paste_text, or run_shell_command's own dispatch -- is discounted from a match for a short time afterward, so waiting for text you just sent does not match its own echo; output that happens to repeat the same words still does. A submitted line that wrapped across terminal rows when it was typed is not discounted. A pattern still on the row being typed into, not yet submitted, reports outcome pending instead of matched, and one already on a completed row before this call attached reports present_at_entry. Waiting owns an observer client until the wait ends. Each list accepts at most 32 patterns, each at most 4,096 bytes, using Rust's linear-time regex engine. Read pane output; accepts no client-supplied executable input. Returned content may be sensitive or untrusted.",
  "schemaStatus": "runtime",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "match_case": {
        "default": false,
        "description": "Match case. Off by default.",
        "type": "boolean"
      },
      "pane": {
        "description": "The `%`-prefixed pane to watch.",
        "type": "string"
      },
      "patterns": {
        "description": "Text that ends the wait successfully. Omit to wait for any output.",
        "items": {
          "type": "string"
        },
        "maxItems": 32,
        "type": [
          "array",
          "null"
        ]
      },
      "regex": {
        "default": false,
        "description": "Read both lists as regular expressions rather than literal text.",
        "type": "boolean"
      },
      "seconds": {
        "description": "How long to wait, in seconds. Defaults to 30, capped at 600.",
        "minimum": 0,
        "type": [
          "integer",
          "null"
        ]
      },
      "stop": {
        "description": "Text that ends the wait as a failure, reported as `stopped`. Omit for\nnone.\n\nGive the failure markers you already know — `error:`, `Traceback` — and\na failed run returns at once instead of at the deadline.",
        "items": {
          "type": "string"
        },
        "maxItems": 32,
        "type": [
          "array",
          "null"
        ]
      }
    },
    "required": [
      "pane"
    ],
    "type": "object"
  },
  "outputSchema": {
    "$defs": {
      "WaitOutcome": {
        "description": "How a wait for text finished.",
        "oneOf": [
          {
            "const": "present_at_entry",
            "description": "A wanted pattern was already in the pane's output before this began\nwatching, on a row above the one still being typed into, and is not\na line this server itself submitted moments earlier.\n\nA wait only sees what a pane writes after it starts, so this is never\nfolded into [`Self::Matched`]: the same pattern printed moments\nearlier -- an earlier command's own output, say -- can already be\nsitting there, and a caller that treated that as a fresh match would\nact on something that happened before this call, not because of it.\nA line this server typed and submitted with `send_keys` is discounted\nrather than reported here or as [`Self::Matched`], for a short time\nafter it was submitted.",
            "type": "string"
          },
          {
            "const": "pending",
            "description": "A wanted pattern's only occurrence is the row still being typed\ninto: text this server (or a person sharing the pane) sent and has\nnot submitted, not anything that has run.\n\nSubmit it, then wait again: the next wait sees the command's own\noutput on a row above a new one still being typed into, which is\n[`Self::PresentAtEntry`] or [`Self::Matched`] depending on when it\narrived, never this -- and never the submitted line's own echo,\nwhich stays discounted for a short time after.",
            "type": "string"
          },
          {
            "const": "matched",
            "description": "A pattern matched, in output that arrived after the wait attached.",
            "type": "string"
          },
          {
            "const": "stopped",
            "description": "A stop pattern matched, so the wait ended early.",
            "type": "string"
          },
          {
            "const": "deadline",
            "description": "The time the caller allowed ran out.",
            "type": "string"
          },
          {
            "const": "pane_closed",
            "description": "The pane stopped writing for good.",
            "type": "string"
          },
          {
            "const": "cancelled",
            "description": "The client withdrew the request while the wait was still running.",
            "type": "string"
          }
        ]
      }
    },
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
      "bytes": {
        "description": "How many bytes arrived, before filtering or truncation.",
        "minimum": 0,
        "type": "integer"
      },
      "matched_index": {
        "description": "Which pattern matched, indexed into the list it came from.",
        "minimum": 0,
        "type": [
          "integer",
          "null"
        ]
      },
      "matched_pattern": {
        "description": "The pattern that matched, as it was given.",
        "type": [
          "string",
          "null"
        ]
      },
      "outcome": {
        "$ref": "#/$defs/WaitOutcome",
        "description": "How the wait finished."
      },
      "pane": {
        "description": "The pane that was watched.",
        "type": "string"
      },
      "text": {
        "description": "What the pane wrote, with escape sequences removed.\n\nThis is the raw output stream, not the rendered screen: a line redrawn\nin place, such as a line editor's echo, repeats. `capture_pane` shows\nthe screen.",
        "type": "string"
      }
    },
    "required": [
      "pane",
      "outcome",
      "text",
      "bytes"
    ],
    "type": "object"
  },
  "annotations": {
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": true,
    "readOnlyHint": true,
    "title": "Wait For Pane Text"
  },
  "meta": {
    "com.git-pull.libtmux-mcp/capability": {
      "amplifiesFutureInput": false,
      "inputLiteralization": {},
      "mayExposeSecrets": true,
      "mayReturnUntrustedContent": true,
      "nestedAuthority": [],
      "outputClasses": [
        "tmux-metadata",
        "terminal-content"
      ],
      "processReach": "none",
      "tmuxEffects": [
        "observe"
      ],
      "toolset": "inspect"
    }
  }
}
