Skip to main content
Glama

clear_queue

Remove all pending URLs from the documentation processing queue to reset it for fresh starts, cancel pending tasks, or eliminate unwanted items.

Instructions

Remove all pending URLs from the documentation processing queue. Use this to reset the queue when you want to start fresh, remove unwanted URLs, or cancel pending processing. This operation is immediate and permanent - URLs will need to be re-added if you want to process them later. Returns the number of URLs that were cleared from the queue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler logic that implements the clear_queue tool. It checks if the queue file exists, reads the current content to count URLs, empties the file to clear the queue, and returns a success message with the count or handles errors.
    async execute(_args: any): Promise<McpToolResponse> { try { // Check if queue file exists try { await fs.access(QUEUE_FILE); } catch { return { content: [ { type: 'text', text: 'Queue is already empty (queue file does not exist)', }, ], }; } // Read current queue to get count of URLs being cleared const content = await fs.readFile(QUEUE_FILE, 'utf-8'); const urlCount = content.split('\n').filter(url => url.trim() !== '').length; // Clear the queue by emptying the file await fs.writeFile(QUEUE_FILE, ''); return { content: [ { type: 'text', text: `Queue cleared successfully. Removed ${urlCount} URL${urlCount === 1 ? '' : 's'} from the queue.`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Failed to clear queue: ${error}`, }, ], isError: true, }; } }
  • The tool schema definition including name, description, and empty input schema (no parameters required).
    get definition(): ToolDefinition { return { name: 'clear_queue', description: 'Clear all URLs from the queue', inputSchema: { type: 'object', properties: {}, required: [], }, }; }
  • Registers the ClearQueueHandler instance for the 'clear_queue' tool in the handlers map.
    this.handlers.set('clear_queue', new ClearQueueHandler(this.server, this.apiClient));
  • Registers the tool schema in the ListTools response, duplicating the definition for tool discovery.
    name: 'clear_queue', description: 'Remove all pending URLs from the documentation processing queue. Use this to reset the queue when you want to start fresh, remove unwanted URLs, or cancel pending processing. This operation is immediate and permanent - URLs will need to be re-added if you want to process them later. Returns the number of URLs that were cleared from the queue.', inputSchema: { type: 'object', properties: {}, }, } as ToolDefinition,
  • The ClearQueueHandler class that extends the tool and delegates handle() to execute(), serving as the MCP request handler entry point.
    export class ClearQueueHandler extends ClearQueueTool { constructor(server: Server, apiClient: ApiClient) { super(); } async handle(args: any) { return this.execute(args); } }

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/jumasheff/mcp-ragdoc-fork'

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