Tools
pastepile_query
Ask a precise, structured question about the memories and pastes your key reaches, using PQL, a read-only query language with an explain mode.
2 min read · Updated
Runs one PQL query. PQL is a small, typed, read-only language over the memories and pastes the configured API key already reaches. Reach for it when a question has structure the other tools cannot express: pastepile_recall searches, this one filters, orders, projects and bounds.
PQL is read only in the strongest sense available: there is no insert, update or delete in the grammar, and nothing in the engine builds SQL. A query runs through the same functions the memory and paste endpoints use, with the same ownership and scope rules applied inside the database.
Parameters
| Parameter | Type | Description | |
|---|---|---|---|
pql | string | required | The query, for example from memory where tags contains "security" since 7d limit 10. |
explain | boolean | optional | Return the plan, the scope in force and the cost class without reading any data. Defaults to false. This is the cheap way to check a query before running it. |
Grammar
FROM memory | pastes WHERE <conditions> AND OR NOT and parentheses SELECT <fields> defaults to a safe metadata projection ORDER BY <field> [ASC|DESC] LIMIT <n> defaults to 20, never unlimited SINCE / AFTER / BEFORE a duration such as 7d, or a quoted date Operators: = != > >= < <= IN CONTAINS STARTS_WITH
Sources are memory and pastes. Fields, and which of them can be filtered, sorted or selected, are listed in the PQL reference. There is no SELECT *, no joins, no aggregates and no functions.
Example
What did we decide about security in the last week?
{
"name": "pastepile_query",
"arguments": {
"pql": "from memory where kind = \"decision\" and tags contains \"security\" since 7d order by updated_at desc limit 10"
}
}{
"source": "memory",
"select": ["slug", "title", "kind", "tags", "updated_at", "encrypted"],
"count": 2,
"exact": false,
"truncated": false,
"effective_scope": "proj/acme",
"cost": "medium",
"results": [
{
"slug": "k3n1p2",
"title": "Rotate the webhook secret quarterly",
"kind": "decision",
"tags": ["security", "webhooks"],
"updated_at": "2026-08-05T09:12:44Z",
"encrypted": false
}
],
"note": "Results were ordered and filtered over a bounded window of what this key can see, not the whole store. Do not describe them as complete."
}Behavior notes
- A query can only narrow. If the key is confined to a project, a query naming anything outside it is refused with
pql_insufficient_scoperather than silently returning nothing.effective_scopein the response says what was actually in force. - `exact: false` matters. It means the page was ordered or filtered over a bounded window of what the key can see, not over everything. Say so rather than presenting the page as complete.
- Encrypted memories keep their secrets.
titleandpreviewcome back empty for them, and full-text matching never reaches them, because Pastepile holds only ciphertext. See Security. - Content is opt in. The default projection is metadata.
previewhas to be named inSELECT, and doing so raises the query's cost class. - An expensive query is refused before it runs.
pql_too_expensivemeans narrowing helps and waiting does not.
An API key is required. Trial memory has no PQL surface, because a query language over a device-local store would answer a different question with the same words.
Related documentation
pastepile_recallSearch your own memory by text, tag, and kind: the configured key's namespace with an API key, or this device's trial memory without one.pastepile_searchSearch pastes by keyword. With an API key it defaults to your private memory; without one it searches the public corpus.pastepile_listList recent pastes, newest first: your saved pastes with an API key, the public feed without one.Security modelWhat the Pastepile MCP server can and cannot touch: local execution, the boundaries around encrypted pastes and encrypted memory, and why protected pastes can never leak into a model context.Rate limits and quotasExact request, size, and expiry limits for anonymous, legacy free-key, Pro, and Enterprise usage of the Pastepile API and MCP server.