Skip to main content
Glama
cancel-scan.js1.45 kB
import { z } from "zod"; import { TOOL_DESCRIPTIONS, TOOL_SUCCESS } from './constants.js'; export function getCancelScanTool(agent) { return { name: "cancel_scan", description: TOOL_DESCRIPTIONS.CANCEL_SCAN, args: {}, handler: async () => { const { backgroundJobs } = agent; if (!backgroundJobs.scan.inProgress) { return { content: [{ type: "text", text: "No scan is currently in progress." }], structuredContent: { success: false, message: "No scan is currently in progress.", currentStatus: backgroundJobs.scan.status } }; } // Set cancellation flag backgroundJobs.scan.cancelled = true; backgroundJobs.scan.status = 'cancelling'; backgroundJobs.scan.endTime = new Date().toISOString(); console.log('Scan cancellation requested by user'); return { content: [{ type: "text", text: "Scan cancellation requested. The scan will stop after the current job completes." }], structuredContent: { success: true, message: "Scan cancellation requested. The scan will stop after the current job completes.", previousStatus: backgroundJobs.scan.status, newStatus: 'cancelling' } }; }, options: { title: "Cancel Current Scan", readOnlyHint: false, openWorldHint: false } }; }

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/adamd9/mcp-jobsearch'

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