{{ theme.skipToContentLabel || 'Skip to content' }}

Templates and result mapping ​

Templates ​

Every string in an adapter definition is a template. Expressions are written {{path | filter | filter:arg}}.

Context ​

VariableExample
repo.idgithub.com/acme/shop
repo.sluggithub.com-acme-shop
repo.nameshop (from the remote)
repo.dirdirectory name of the main worktree
repo.rootabsolute path of the current worktree
repo.remote, repo.branch, repo.worktree
project.name[project] name, else the root manifest's name, else repo.name
vars.<name>global [vars] merged with the adapter's vars
env.<NAME>environment variable
now.date, now.iso2026-09-28, RFC 3339 timestamp
adapter.name

Op inputs:

OpVariables
search, codequery, limit
historytarget, query (same value), limit
readuri, level
briefquery, focus
llmprompt
event deliveries (store, …)id, kind, title, status, date, summary, tags, paths, body, markdown, path, visibility, source.repo, source.branch
declared toolsargs.<name> and each argument by name
command ops with output_file = trueoutput_file

Filters ​

FilterResult
urlencodepercent-encoded
jsonJSON text of the value
lower, upper, trim, slug
first_line
join:<sep>joins a list (join:, · join: )
truncate:<n>at most n characters
after:<sep>, before:<sep>the part after / before the first separator (the whole value when absent)
default:<literal>used when the value is missing or empty (`{{env.URL
inta string parsed as an integer

Quoted literals work as values: {{'text'|upper}}.

Types ​

  • A JSON value that is exactly one expression keeps its type: limit = "{{limit}}" sends a number, tags = "{{tags}}" sends an array.
  • Anything else is rendered as a string.
  • Object members that render to null are dropped, so optional arguments disappear instead of being sent empty.

Paths ​

items, text, where keys and map values use a small path language over JSON:

SyntaxMeaning
a.b.cobject keys
a[0]array index
a[*]every element of an array
*every value of an object (or element of an array)
$ or emptythe root
`ab`

Examples: result.memories[*], result.*[*] (every list under result), data[*].attributes, results[0].title.

Mapping hits ​

For search, history and code ops each item becomes a hit with title, snippet, uri, score, kind and date.

map valueMeaning
name / a.b / `ab`
re:<regex>first capture group (or the whole match) of the regex on the item's text
tpl:<template>a template rendered against the item (tpl:notes://{{id}})
=<literal>a constant

Fallbacks when a field is not mapped:

FieldTried keys
titletitle, name, subject, heading, uri, path, id
snippetsnippet, abstract, summary, content, text, description, body, overview
uriuri, url, path, file, id
scorescore, relevance, similarity, rank (else by position)
kindkind, type, context_type, category
datedate, created_at, updated_at, time, timestamp

Items without a title and a snippet are dropped. URIs that should be readable through ctx_read need a scheme (notes://…) and a read op that owns the prefix.

Payload formats ​

formatParsing
auto (default)JSON when it parses (log lines before the JSON are skipped), else text
jsonJSON or null
jsonlone JSON value per line → a list
linesnon-empty lines → a list of strings
textthe raw text

MCP tool results are unwrapped first: structuredContent if present, else the text content (parsed as JSON when possible).

Released under the MIT or Apache-2.0 license.