mavis_memory_search
Search stored memory entries across user, agent, or project scopes using a natural language query to retrieve relevant information.
Instructions
Search Mavis memory for entries matching a query.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | Memory scope to search | |
| query | Yes | Search query |
Implementation Reference
- src/index.js:284-296 (registration)The tool registration definition in the tools array. Defines name 'mavis_memory_search', input schema (optional scope enum, required query string), and buildArgs which constructs the CLI arguments as ['memory', 'search', <query>] with optional scope prepended.
{ name: 'mavis_memory_search', description: 'Search Mavis memory for entries matching a query.', inputSchema: z.object({ scope: z.enum(['user', 'agent', 'project']).optional().describe('Memory scope to search'), query: z.string().describe('Search query') }), buildArgs: ({ scope, query }) => { const args = ['memory', 'search', query]; if (scope) args.unshift(scope); return args; } }, - src/index.js:287-290 (schema)Input schema using Zod: optional 'scope' (one of user/agent/project) and required 'query' (string) for searching Mavis memory.
inputSchema: z.object({ scope: z.enum(['user', 'agent', 'project']).optional().describe('Memory scope to search'), query: z.string().describe('Search query') }), - src/index.js:77-92 (handler)The generic tool handler (runTool). For 'mavis_memory_search' (no execFn, no outputMode), it calls execMavisJSON (which parses JSON output) and returns JSON-stringified result as text.
function runTool(spec, parsedArgs) { const { execFn, outputMode, stdin, buildArgs } = spec; const args = buildArgs(parsedArgs); const input = typeof stdin === 'function' ? stdin(parsedArgs) : stdin; const execPromise = execFn ? execMavis(args, input || '') : execMavisJSON(args); return execPromise.then(result => { const text = outputMode === OUTPUT_RAW ? (result || '') : JSON.stringify(result, null, 2); return [{ type: 'text', text }]; }); } - src/index.js:55-64 (helper)Helper that executes the CLI command via execMavis and parses the output as JSON (used by mavis_memory_search since it has no execFn).
function execMavisJSON(args) { return execMavis(args).then(raw => { try { return JSON.parse(raw); } catch { const jsonStart = raw.indexOf('{'); return JSON.parse(jsonStart >= 0 ? raw.slice(jsonStart) : raw); } }); }