clear_queue
Clear all pending URLs from the documentation processing queue to reset it, remove unwanted items, or cancel pending processing.
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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/clear-queue.ts:25-66 (handler)Core handler logic that checks if the queue file exists, counts the URLs in it, empties the file, 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, }; }
- src/tools/clear-queue.ts:13-22 (schema)Tool 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: [], }, };
- src/handlers/clear-queue.ts:5-13 (handler)MCP handler class that extends the tool and provides the handle method to delegate execution to the tool's execute method.export class ClearQueueHandler extends ClearQueueTool { constructor(server: Server, apiClient: ApiClient) { super(); } async handle(args: any) { return this.execute(args); } }
- src/handler-registry.ts:44-44 (registration)Registers the ClearQueueHandler instance in the handlers map with key 'clear_queue'.this.handlers.set('clear_queue', new ClearQueueHandler(this.server, this.apiClient));
- src/handler-registry.ts:130-137 (schema)Tool schema exposed in the list_tools response, including detailed description and input schema.{ 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,