list_searches
View all active searches with their IDs, types, patterns, status, and runtime to manage multiple concurrent search operations effectively.
Instructions
List all active searches.
Shows search IDs, search types, patterns, status, and runtime.
Similar to list_sessions for terminal processes. Useful for managing
multiple concurrent searches.
This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/search-handlers.ts:220-256 (handler)The handler function that implements the core logic of the 'list_searches' tool. It retrieves active search sessions from the searchManager, formats a status report including session IDs, types, patterns, statuses, runtimes, and result counts, and returns it as a text response. Handles empty list and errors gracefully.export async function handleListSearches(): Promise<ServerResult> { try { const sessions = searchManager.listSearchSessions(); if (sessions.length === 0) { return { content: [{ type: "text", text: "No active searches." }], }; } let output = `Active Searches (${sessions.length}):\n\n`; for (const session of sessions) { const status = session.isComplete ? (session.isError ? '❌ ERROR' : '✅ COMPLETED') : '🔄 RUNNING'; output += `Session: ${session.id}\n`; output += ` Type: ${session.searchType}\n`; output += ` Pattern: "${session.pattern}"\n`; output += ` Status: ${status}\n`; output += ` Runtime: ${Math.round(session.runtime / 1000)}s\n`; output += ` Results: ${session.totalResults}\n\n`; } return { content: [{ type: "text", text: output }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error listing search sessions: ${errorMessage}` }], isError: true, }; } }
- src/tools/schemas.ts:174-174 (schema)Zod schema defining the empty input arguments for the 'list_searches' tool (no parameters required).export const ListSearchesArgsSchema = z.object({});
- src/server.ts:606-620 (registration)Tool specification registration in the list_tools handler, defining name, description, input schema reference, and annotations for the MCP tools list.name: "list_searches", description: ` List all active searches. Shows search IDs, search types, patterns, status, and runtime. Similar to list_sessions for terminal processes. Useful for managing multiple concurrent searches. ${CMD_PREFIX_DESCRIPTION}`, inputSchema: zodToJsonSchema(ListSearchesArgsSchema), annotations: { title: "List Active Searches", readOnlyHint: true, }, },
- src/server.ts:1276-1278 (registration)Dispatch registration in the call_tool switch statement, mapping the 'list_searches' tool name to the handleListSearches handler execution.case "list_searches": result = await handlers.handleListSearches(); break;