Tools

agentgrep’s tools are read-only. They return structured Pydantic models and protect private paths before serialization. Invalid-parameter responses return concise field errors without echoing rejected values. Audit logging redacts sensitive terms, pattern, sample_text, and cursor fields.

Time-Windowed Activity

recent_sessions

recent_sessions
search tool
search tool
recent_sessions

Return sources modified in the last N hours, newest-first.

Use when you want the most-recently modified sources for an agent — newest-first, optionally bounded by a time window.

Returns: the cutoff timestamp plus source records ordered by mtime_ns descending.

Parameters

Parameter

Type

Required

Default

Description

agent

AgentSelector

no

'all'

Limit discovery to one agent or scan every agent.

hours

int

no

24

Look back this many hours (max 30 days).

limit

int

no

10

Maximum number of sources to return.

Store Discovery

find

find
discovery tool
discovery tool
find

Find known agent stores, session files, and SQLite databases.

Returns:

FindToolResponse

Use when you need to inspect which stores, session files, and databases agentgrep can read.

Returns: request metadata, run status, result stats, page metadata, and source records with ref, agent, store, adapter, protected path, path kind, and metadata. When page.next_cursor is present, pass it back as cursor to continue the same discovery scan.

Example:

{
  "tool": "find",
  "arguments": {
    "pattern": "sessions",
    "agent": "codex",
    "limit": 50
  }
}

Parameters

Parameter

Type

Required

Default

Description

pattern

str

no

—

Optional substring filter against discovered paths and adapters.

agent

AgentSelector

no

'all'

Limit discovery to one agent or search all agents.

limit

int

no

50

Maximum number of discovered sources to return.

cursor

str

no

—

Opaque page cursor returned by a previous find response.

Structured Source Listing

list_sources

list_sources
discovery tool
discovery tool
list_sources

List discovered sources with structured path-kind/source-kind filters.

Use when you want a structured listing of discovered sources with optional path-kind, source-kind, and coverage filters. By default this matches the default-search surface; pass include_non_default=true or set coverage_filter to inspect inventory-only stores such as Codex SQLite DBs or Claude session memory. Each returned source includes searchable, coverage-based search_by_default, store_role, required_effort, searchable_reason, inspectable, and version_detection. Coverage reports whether normal discovery admits a source before effort and role filtering; required_effort reports whether a prompt search can read it with prompt effort or needs exhaustive effort. version_detection records the strategy and evidence agentgrep used to identify the app/data version for that concrete file or DB.

Parameters

Parameter

Type

Required

Default

Description

agent

AgentSelector

no

'all'

Limit discovery to one agent or scan every agent.

path_kind_filter

enum

no

—

Filter by path kind. One of: 'history_file', 'session_file', 'sqlite_db', 'store_file'.

source_kind_filter

enum

no

—

Filter by on-disk source kind. One of: 'json', 'jsonl', 'sqlite', 'text', 'opaque'.

coverage_filter

enum

no

—

Filter by coverage level. One of: 'default_search', 'inspectable', 'catalog_only', 'private'.

include_non_default

bool

no

False

Include non-default inventory sources when true.

limit

int

no

—

Maximum number of sources to return.

Required-Pattern Filtering

filter_sources

filter_sources
discovery tool
discovery tool
filter_sources

Filter discovered sources by required substring pattern.

Returns:

FindToolResponse

Use when you want to narrow discovered sources by required substring pattern (a stricter find).

Parameters

Parameter

Type

Required

Default

Description

pattern

str

no

—

Required substring pattern unless cursor is provided.

agent

AgentSelector

no

'all'

Limit discovery to one agent or scan every agent.

limit

int

no

50

Maximum number of sources to return.

cursor

str

no

—

Opaque page cursor returned by a previous filter_sources response.

Discovery Counts

summarize_discovery

summarize_discovery
discovery tool
discovery tool
summarize_discovery

Aggregate counts of discovered sources by agent, format, and kind.

Use when you want aggregate counts of discovered sources by agent, format, and path-kind.

Parameters

Parameter

Type

Required

Default

Description

agent

AgentSelector

no

'all'

Limit discovery to one agent or scan every agent.

Catalog catalog

list_stores

list_stores
catalog tool
catalog tool
list_stores

List on-disk agent stores from the agentgrep catalog.

Use when you want the canonical catalog of on-disk stores agentgrep knows about — including stores that are not searched by default.

Parameters

Parameter

Type

Required

Default

Description

agent

CatalogAgentSelector

no

'all'

Filter to one catalog agent, including catalog-only agents, or ‘all’.

role_filter

str

no

—

Filter to one StoreRole value (e.g. ‘primary_chat’).

search_default_only

bool

no

False

Return only stores in the default-search eligibility tier.

get_store_descriptor

get_store_descriptor
catalog tool
catalog tool
get_store_descriptor

Return the catalog descriptor for a single store by id.

Use when you need the full descriptor (role, format, upstream reference, schema notes) for a single store id.

Parameters

Parameter

Type

Required

Default

Description

store_id

str

yes

—

Store id (e.g. ‘claude.projects.session’).

inspect_record_sample

inspect_record_sample
catalog tool
catalog tool
inspect_record_sample

Read the first N records from one adapter+path for schema inspection.

Use when you want a few raw records from one adapter+path to validate parser output or discover schema variations.

Parameters

Parameter

Type

Required

Default

Description

adapter_id

str

yes

—

Adapter id (e.g. ‘claude.projects_jsonl.v1’).

source_path

str

yes

—

Path returned by list_sources; ‘~’ home prefixes are accepted.

sample_size

int

no

1

Number of records to return (1-20).

inspect_result

inspect_result
search tool
search tool
inspect_result

Inspect records behind an opaque search/find result ref.

Use when you have a ref returned by search or find and need to inspect the matching result or sample records from that source without reconstructing local paths.

Parameters

Parameter

Type

Required

Default

Description

ref

str

yes

—

Opaque ref from a search or find result.

sample_size

int

no

1

Number of source records to return for find refs (1-20).

Diagnostics

validate_query

validate_query
diagnostic tool
diagnostic tool
validate_query

Dry-run terms against sample text and/or validate query-language syntax. Supported syntax includes field predicates, booleans, and phrases; no files are searched.

Use when you want to dry-run a literal pattern against sample text before issuing a broad cross-agent search.

Parameters

Parameter

Type

Required

Default

Description

terms

list[str]

no

—

Literal/regex terms to test against sample_text.

query

str

no

—

Query-language string to parse and compile; reports query_valid and any parse/compile error.

sample_text

str

no

''

Sample text to test terms against.

case_sensitive

bool

no

False

Perform case-sensitive matching.