pa-db-get-messages
by rob
Retrieve messages from the PA2 SQLite database. Queries the messages table and returns conversation history filtered by conversation_id, role, or limit.
# pa-db-get-messages
Retrieve messages from the PA2 SQLite database. Queries the messages table and returns conversation history filtered by conversation_id, role, or limit.
## Installation
This is a CmdForge tool. It should be available in your PATH after PA2 setup. CmdForge tools are invoked via subprocess or shell commands.
## Usage
```bash
# Get messages with specific filters
echo '{"conversation_id": "conv-123"}' | pa-db-get-messages --db-path ~/.pa2/data/pa2.db
# Get messages by role
echo '{"role": "user"}' | pa-db-get-messages --db-path ~/.pa2/data/pa2.db
# Limit number of messages returned
echo '{"limit": 10}' | pa-db-get-messages --db-path ~/.pa2/data/pa2.db
# Combine filters
echo '{"conversation_id": "conv-123", "role": "assistant", "limit": 5}' | pa-db-get-messages --db-path ~/.pa2/data/pa2.db
```
## Arguments
| Flag | Default | Description |
|------|---------|-------------|
| `--db-path` | *(required)* | Path to SQLite database file |
## How It Works
This tool executes a single-step pipeline:
1. **query_database** (code): Connects to the SQLite database and queries the messages table based on the provided filters (conversation_id, role, limit). Returns matching messages in JSON format.
The tool expects JSON input via stdin with optional filter fields:
- `conversation_id`: Filter by conversation ID
- `role`: Filter by message role (user/assistant/system)
- `limit`: Maximum number of messages to return
## Dependencies
None
Reviews
Login to reviewNo reviews yet.
Issues
No issues reported for this tool.
Write a Review
Share your experience with this tool.
0/2000
Report an Issue
Help improve this tool by reporting bugs or security issues.