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
readonly tool
readonly 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

t.Annotated[AgentSelector, Field(description='Limit discovery to one agent or scan every agent.')]

no

'all'

hours

t.Annotated[int, Field(default=24, ge=1, le=24 * 30, description=’Look back this many hours (max 30 days).’, examples=[1, 24, 168])]

no

24

limit

t.Annotated[int | None, Field(default=10, ge=1, description='Maximum number of sources to return.')]

no

10

Store Discovery

find

find
readonly tool
readonly 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

t.Annotated[str | None, Field(default=None, description='Optional substring filter against discovered paths and adapters.')]

no

agent

t.Annotated[AgentSelector, Field(description='Limit discovery to one agent or search all agents.')]

no

'all'

limit

t.Annotated[int | None, Field(default=50, ge=1, description='Maximum number of discovered sources to return.')]

no

50

cursor

t.Annotated[str | None, Field(default=None, description='Opaque page cursor returned by a previous find response.')]

no

Structured Source Listing

list_sources

list_sources
readonly tool
readonly 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

t.Annotated[AgentSelector, Field(description='Limit discovery to one agent or scan every agent.')]

no

'all'

path_kind_filter

t.Annotated['history_file', 'session_file', 'sqlite_db', 'store_file' | None, Field(default=None, description='Filter by path kind.')]

no

source_kind_filter

t.Annotated['json', 'jsonl', 'sqlite', 'text', 'opaque' | None, Field(default=None, description='Filter by on-disk source kind.')]

no

coverage_filter

t.Annotated['default_search', 'inspectable', 'catalog_only', 'private' | None, Field(default=None, description='Filter by coverage level.')]

no

include_non_default

t.Annotated[bool, Field(default=False, description='Include non-default inventory sources when true.')]

no

False

limit

t.Annotated[int | None, Field(default=None, ge=1, description='Maximum number of sources to return.')]

no

Required-Pattern Filtering

filter_sources

filter_sources
readonly tool
readonly 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

t.Annotated[str | None, Field(default=None, min_length=1, description='Required substring pattern unless cursor is provided.', examples=['state', '.jsonl'])]

no

agent

t.Annotated[AgentSelector, Field(description='Limit discovery to one agent or scan every agent.')]

no

'all'

limit

t.Annotated[int | None, Field(default=50, ge=1, description='Maximum number of sources to return.')]

no

50

cursor

t.Annotated[str | None, Field(default=None, description='Opaque page cursor returned by a previous filter_sources response.')]

no

Discovery Counts

summarize_discovery

summarize_discovery
readonly tool
readonly 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

t.Annotated[AgentSelector, Field(description='Limit discovery to one agent or scan every agent.')]

no

'all'

Catalog readonly

list_stores

list_stores
readonly tool
readonly 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

t.Annotated[CatalogAgentSelector, Field(default='all', description="Filter to one catalog agent, including catalog-only agents, or 'all'.", examples=['all', 'claude', 'windsurf'])]

no

'all'

role_filter

t.Annotated[str | None, Field(default=None, description="Filter to one StoreRole value (e.g. 'primary_chat').", examples=['primary_chat', 'prompt_history'])]

no

search_default_only

t.Annotated[bool, Field(default=False, description='Return only stores in the default-search eligibility tier.')]

no

False

get_store_descriptor

get_store_descriptor
readonly tool
readonly 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

t.Annotated[str, Field(min_length=1, description="Store id (e.g. 'claude.projects.session').", examples=['claude.projects.session', 'codex.history'])]

yes

inspect_record_sample

inspect_record_sample
readonly tool
readonly 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

t.Annotated[str, Field(min_length=1, description="Adapter id (e.g. 'claude.projects_jsonl.v1').", examples=['claude.projects_jsonl.v1', 'codex.history_json.v1'])]

yes

source_path

t.Annotated[str, Field(min_length=1, description="Path returned by list_sources; '~' home prefixes are accepted.")]

yes

sample_size

t.Annotated[int, Field(default=1, ge=1, le=20, description='Number of records to return (1-20).')]

no

1

inspect_result

inspect_result
readonly tool
readonly 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

t.Annotated[str, Field(min_length=1, description='Opaque ref from a search or find result.')]

yes

sample_size

t.Annotated[int, Field(default=1, ge=1, le=20, description='Number of source records to return for find refs (1-20).')]

no

1

Diagnostics

validate_query

validate_query
readonly tool
readonly tool
validate_query

Dry-run terms against sample text and/or validate query-language syntax.

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

t.Annotated[list[str] | None, Field(default=None, description='Literal/regex terms to test against sample_text.')]

no

query

t.Annotated[str | None, Field(default=None, description='Query-language string to parse and compile; reports query_valid and any parse/compile error.')]

no

sample_text

t.Annotated[str, Field(description='Sample text to test terms against.')]

no

''

case_sensitive

t.Annotated[bool, Field(description='Perform case-sensitive matching.')]

no

False