# Query Tag
The `{query}` tag is the unified entry point for data in any pipeline. It replaces the need for explicit `--text` or `--file` arguments and works seamlessly across CLI and IDE environments.
## How It Works
The engine automatically scans your pipeline for the `{query}` tag. If found, it enables input reading.
- **CLI**: Reads from a positional argument (`vibe-action my-action "text"`). If not provided, it falls back to the system clipboard.
- **IDE**: The plugin provides the context based on the `api.input` setting (e.g., editor selection, file path).
## Query Types (Modifiers)
You can specify the type of input using the pipe syntax: `{query|type}`.
| `{query}` or `{query\|raw}` | Raw text from argument or clipboard | Editor selection text |
| `{query\|file_path}` | Validates text as a local file path | Path to the current file |
| `{query\|project_path}` | Searches for project root (`.git`, `Cargo.toml`, etc.) | Project root path |
| `{query\|line}` | First line of the text | Cursor line number |
| `{query\|prompt}` | Interactive prompt in terminal | IDE input dialog |
| `{query\|image}` | Image from clipboard or file path (base64 PNG) | Screenshot or selected image |
## Usage Example
```yaml
name: my-action
api:
output: replace
input: query # Tell IDE to pass selection to {query}
actions:
- tag: tag_content
run: cmd
expect: string
check: .+
action:
# If input is a valid file path, read it. Otherwise, treat as text.
- when: '{query|file_path|empty:not}'
then: cat "{query|file_path|load}"
- when: '{query|empty:not}'
then: echo "{query}"
- when: 'true'
then: echo "ERROR - No input provided"
```
## IDE Integration (`api.input`)
To control how the IDE plugin fills the `{query}` tag, use the `api` block:
```yaml
api:
output: replace # replace | clipboard | dialog
input: query|file_path # query | query|file_path | query|prompt | etc.
```
If `input` is omitted, it defaults to `query` (editor selection).