stop_search
Stop active background search processes in Desktop Commander MCP. Gracefully terminate ongoing searches when results are found or operations take too long, while preserving final results for review.
Instructions
Stop an active search.
Stops the background search process gracefully. Use this when you've found
what you need or if a search is taking too long. Similar to force_terminate
for terminal processes.
The search will still be available for reading final results until it's
automatically cleaned up after 5 minutes.
This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes |
Implementation Reference
- src/handlers/search-handlers.ts:180-215 (handler)The main handler function that implements the logic for the stop_search tool. It validates input using StopSearchArgsSchema, calls searchManager.terminateSearch(sessionId), and returns appropriate success or error messages.export async function handleStopSearch(args: unknown): Promise<ServerResult> { const parsed = StopSearchArgsSchema.safeParse(args); if (!parsed.success) { return { content: [{ type: "text", text: `Invalid arguments for stop_search: ${parsed.error}` }], isError: true, }; } try { const success = searchManager.terminateSearch(parsed.data.sessionId); if (success) { return { content: [{ type: "text", text: `Search session ${parsed.data.sessionId} terminated successfully.` }], }; } else { return { content: [{ type: "text", text: `Search session ${parsed.data.sessionId} not found or already completed.` }], }; } } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error terminating search session: ${errorMessage}` }], isError: true, }; } }
- src/tools/schemas.ts:170-172 (schema)Zod schema defining the input parameters for the stop_search tool: requires a sessionId string.export const StopSearchArgsSchema = z.object({ sessionId: z.string(), });
- src/server.ts:591-604 (registration)Registration of the stop_search tool in the list_tools MCP handler, including name, description, and input schema reference.name: "stop_search", description: ` Stop an active search. Stops the background search process gracefully. Use this when you've found what you need or if a search is taking too long. Similar to force_terminate for terminal processes. The search will still be available for reading final results until it's automatically cleaned up after 5 minutes. ${CMD_PREFIX_DESCRIPTION}`, inputSchema: zodToJsonSchema(StopSearchArgsSchema), },
- src/server.ts:1272-1274 (registration)Dispatch mapping in the call_tool MCP handler that routes stop_search calls to the handleStopSearch function.case "stop_search": result = await handlers.handleStopSearch(args); break;