Get a previous scan by id
get_scanRetrieve a scan by its unique ID to access its 0-100 readability score and detailed remediation hints for each failing check.
Instructions
Fetches a completed or in-progress scan by its id. Only scans owned by the authenticated API key's user are returned.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Scan id returned by a previous scan_site call (10-character nanoid). |
Implementation Reference
- src/tools/getScan.ts:10-26 (handler)The main handler function for the get_scan tool. Calls getScanFromApi with the scan id and returns the result as JSON.
export async function getScanById( config: Config, input: { id: string }, ): Promise<ToolResult> { try { const scan = await getScanFromApi(config, input.id); return { content: [{ type: "text", text: JSON.stringify(scan) }] }; } catch (err) { if (err instanceof ApiError) { if (err.status === 404) { throw new ToolError("not_found", `Scan ${input.id} not found.`); } throw new ToolError(err.code, err.message); } throw err; } } - src/server.ts:46-62 (registration)Registration of the 'get_scan' tool with the MCP server, including metadata (title, description) and the handler callback that invokes getScanById.
server.registerTool( "get_scan", { title: "Get a previous scan by id", description: "Fetches a completed or in-progress scan by its id. Only scans owned by the authenticated API key's user are returned.", inputSchema: getScanInputShape, annotations: READ_ONLY_OPEN_WORLD, }, async (args) => { try { return await getScanById(config, args); } catch (err) { return toolErrorToContent(err); } }, ); - src/types.ts:24-32 (schema)Zod input schema for get_scan: requires a single 'id' field (string, 1-100 chars) described as a scan id returned by scan_site.
export const getScanInputShape = { id: z .string() .min(1) .max(100) .describe( "Scan id returned by a previous scan_site call (10-character nanoid).", ), } as const;