Skip to main content
Glama

Get a previous scan by id

get_scan
Read-onlyIdempotent

Retrieve 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

TableJSON Schema
NameRequiredDescriptionDefault
idYesScan id returned by a previous scan_site call (10-character nanoid).

Implementation Reference

  • 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);
        }
      },
    );
  • 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;
Behavior4/5

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

Adds context beyond annotations: scans can be completed or in-progress, only owned by authenticated user. No contradiction with annotations.

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

Conciseness5/5

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

Two concise sentences, front-loaded with purpose, no redundant information.

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

Completeness5/5

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

Given simple tool with one param, annotations, and no output schema, description is fully complete for agent usage.

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?

Schema coverage is 100% with clear parameter description. Description adds ownership context but doesn't further elaborate parameter semantics.

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

Purpose5/5

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

Description clearly states 'Fetches a completed or in-progress scan by its id' with ownership scope, distinguishing it from sibling 'scan_site' which creates scans.

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

Usage Guidelines4/5

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

Explicitly mentions when to use (by id) and ownership restriction, but lacks explicit when-not-to-use or alternative tools context.

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/mlava/agent-ready-mcp'

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