---
title: "Search your memory (dev docs / papers + vault markdown files) and get ranked snippets with IDs."
method: POST
path: "/api/mcp/tools/memory_search"
tags: ["misc"]
---

# Search your memory (dev docs / papers + vault markdown files) and get ranked snippets with IDs.

`POST /api/mcp/tools/memory_search`

## Request

- Base URL: `https://api.ainote.dev`
- URL: `https://api.ainote.dev/api/mcp/tools/memory_search`
- Auth: API key in header `Authorization`

Search your memory (dev docs / papers + vault markdown files) and get ranked snippets with IDs.

COST PRINCIPLE: search returns snippets only; call memory_get for full content.

MODES:
- keyword (default): hybrid keyword + semantic match across title/path/content
- latest_state: most recent memory, preferring entries saved with memory_type='state'
  (falls back to plain recency when no typed entries exist)

Returns { found: false, message: "no memory found" } when nothing matches — treat that
as a definitive empty signal and stop searching (do not guess).

## Request body

- object
  - `query` string, required: Search text (e.g. 'render deploy key', 'ainote jwt'). May be blank only in latest_state mode.
  - `mode` 'keyword' | 'latest_state': keyword (default) or latest_state
  - `sources` string[]: Memory stores to search. Default: both.
  - `limit` integer: Max results (default 10, max 20)
  - `hop` integer: Expand results by following [[wikilinks]] N hops from keyword hits (vault only). Scores decay 0.5 per hop. Default 0 (off).

## Response `200`

Tool executed successfully

- ToolSuccessResponse: Successful tool invocation. `content` mirrors the MCP `tools/call` result shape: an array of content blocks (text and optionally a structured resource payload).
  - `content` object[]
    - `type` 'text' | 'resource'
    - `text` string

## Other responses

- `400`: Invalid arguments or business-rule violation
- `401`: Missing or invalid McpKey

---

[API](https://skmtc.dev/ainote/apis/ainote-mcp-openapi-mirror.md) · [All operations](https://skmtc.dev/ainote/apis/ainote-mcp-openapi-mirror/llms.txt) · [OpenAPI document](https://skmtc.dev/ainote/apis/ainote-mcp-openapi-mirror/revisions/f6c91d85e027?raw)
