Skip to main content
Glama

stop_search

Stop active background searches in Desktop Commander MCP to conserve resources when results are found or processes take too long.

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
NameRequiredDescriptionDefault
sessionIdYes

Implementation Reference

  • The main handler function for the 'stop_search' tool. It validates input using StopSearchArgsSchema, then calls searchManager.terminateSearch(sessionId) to stop the search process, returning appropriate success or error messages.
    /**
     * Handle stop_search command
     */
    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,
        };
      }
    }
  • Zod schema defining the input arguments for the stop_search tool: requires a 'sessionId' string.
    export const StopSearchArgsSchema = z.object({
      sessionId: z.string(),
    });
  • Core helper method in SearchManager that terminates the ChildProcess of the search session by sending SIGTERM, returns true if session existed.
    terminateSearch(sessionId: string): boolean {
      const session = this.sessions.get(sessionId);
      
      if (!session) {
        return false;
      }
    
      if (!session.process.killed) {
        session.process.kill('SIGTERM');
      }
    
      // Don't delete session immediately - let user read final results
      // It will be cleaned up by cleanup process
      
      return true;
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=false and destructiveHint=false, but the description adds valuable behavioral context beyond this: it specifies that the stop is 'graceful', mentions that results remain available for 5 minutes after stopping, and notes the tool can be referenced in specific ways. This enhances understanding without contradicting annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and structured into clear, relevant sentences about usage, behavior, and references. While slightly verbose in the last sentence about referencing, it efficiently conveys key information without unnecessary fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (stopping a process) and lack of output schema, the description does well by explaining the graceful stop behavior and result availability. It covers usage context and behavioral traits, though it could improve by detailing the parameter or expected outcomes more fully.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, with one required parameter 'sessionId' undocumented. The description does not mention or explain this parameter at all, failing to compensate for the schema gap. However, since the parameter count is low (1), the baseline remains at 3, but no additional semantic value is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Stop an active search') and the resource ('background search process'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its sibling 'force_terminate' beyond a comparison, missing a direct distinction that would warrant a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use the tool ('when you've found what you need or if a search is taking too long') and references an alternative ('Similar to force_terminate for terminal processes'), clearly distinguishing it from other tools. This helps the agent understand the appropriate context and alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wonderwhy-er/ClaudeComputerCommander'

If you have feedback or need assistance with the MCP directory API, please join our Discord server