Skip to main content
Glama
SurfRankAI

SurfRank MCP Server

by SurfRankAI

get_quick_test

Retrieve a single quick test by its ID to view its status and results.

Instructions

Get a single quick test by ID, including status and results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testIdYes

Implementation Reference

  • The 'get_quick_test' tool definition, including its schema (testId required) and handler that calls api.get('/quick-test/${testId}')
    {
      name: 'get_quick_test',
      description: 'Get a single quick test by ID, including status and results.',
      inputSchema: {
        type: 'object',
        properties: { testId: { type: 'string' } },
        required: ['testId'],
      },
      handler: async ({ testId }) => api.get(`/quick-test/${testId}`),
    },
  • The quickTestTools array is exported and registered in src/index.js (line 26/35). This file defines all quick test tools including get_quick_test.
    export const quickTestTools = [
      {
        name: 'run_quick_test',
        description:
          'Start a "quick test" — a low-cost (1 credit) AI-visibility snapshot for a domain. ' +
          'Returns immediately; the test runs asynchronously. Use `get_quick_test` to poll. ' +
          'If your API key is scoped to a project, `websiteId` must match that project.',
        inputSchema: {
          type: 'object',
          properties: {
            domain: { type: 'string', description: 'Root domain, e.g. "example.com"' },
            brandName: { type: 'string', description: 'Brand name (optional — auto-detected if omitted)' },
            country: { type: 'string', description: 'ISO-2 country code (e.g. "US")' },
            engines: {
              type: 'array',
              items: { type: 'string' },
              description: 'AI engines to query (e.g. ["chatgpt", "perplexity"]). Defaults to all available.',
            },
            websiteId: { type: 'string', description: 'Optional — link the test to an existing project.' },
          },
          required: ['domain'],
        },
        handler: async (input) => api.post('/quick-test', input),
      },
      {
        name: 'list_quick_tests',
        description: 'List quick tests, optionally filtered by project.',
        inputSchema: {
          type: 'object',
          properties: {
            websiteId: { type: 'string', description: 'Filter to a specific project (optional)' },
          },
        },
        handler: async ({ websiteId }) => api.get('/quick-test', { websiteId }),
      },
      {
        name: 'get_quick_test',
        description: 'Get a single quick test by ID, including status and results.',
        inputSchema: {
          type: 'object',
          properties: { testId: { type: 'string' } },
          required: ['testId'],
        },
        handler: async ({ testId }) => api.get(`/quick-test/${testId}`),
      },
      {
        name: 'select_quick_test_keywords',
        description:
          'After a quick test reaches `awaiting_keyword_selection`, pick 1–5 keywords to analyse ' +
          'in depth. This kicks off the main analysis pass.',
        inputSchema: {
          type: 'object',
          properties: {
            testId: { type: 'string' },
            keywords: {
              type: 'array',
              items: { type: 'string' },
              minItems: 1,
              maxItems: 5,
            },
          },
          required: ['testId', 'keywords'],
        },
        handler: async ({ testId, keywords }) =>
          api.post(`/quick-test/${testId}/select-keywords`, { keywords }),
      },
    ];
  • src/index.js:31-41 (registration)
    All tools (including quickTestTools) are collected into ALL_TOOLS and then a Map is built (line 41) keyed by tool name for dispatch via CallToolRequestSchema handler.
    const ALL_TOOLS = [
      ...projectTools,
      ...keywordTools,
      ...reportTools,
      ...quickTestTools,
      ...keywordResearchTools,
      ...competitorTools,
      ...opportunityTools,
    ];
    
    const toolByName = new Map(ALL_TOOLS.map((t) => [t.name, t]));
  • The CallToolRequestSchema handler dispatches tool calls by name; it looks up the tool in toolByName map and calls tool.handler(args), which for get_quick_test calls the API client.
    // Execute a tool.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args = {} } = request.params;
      const tool = toolByName.get(name);
      if (!tool) {
        return {
          isError: true,
          content: [{ type: 'text', text: `Unknown tool: ${name}` }],
        };
      }
    
      try {
        const result = await tool.handler(args);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (err) {
        // Surface the SurfRank error message verbatim so the model can react
        // (e.g. "insufficient credits" → tell the user to top up).
        const message = err?.message || 'Unknown error';
        return {
          isError: true,
          content: [{ type: 'text', text: message }],
        };
      }
    });
  • The HTTP client used by the get_quick_test handler. api.get(path, query) calls request('GET', ...) which sends a fetch to the SurfRank API with the API key header.
    export async function request(method, path, { query, body } = {}) {
      const url = new URL(baseUrl() + path);
      if (query) {
        for (const [k, v] of Object.entries(query)) {
          if (v !== undefined && v !== null && v !== '') url.searchParams.set(k, String(v));
        }
      }
    
      const headers = {
        'X-API-Key': apiKey(),
        Accept: 'application/json',
        'User-Agent': '@surfrank/mcp-server',
      };
      const init = { method, headers };
      if (body !== undefined) {
        headers['Content-Type'] = 'application/json';
        init.body = JSON.stringify(body);
      }
    
      let res;
      try {
        res = await fetch(url, init);
      } catch (err) {
        throw new Error(`SurfRank API network error: ${err.message}`);
      }
    
      const text = await res.text();
      let parsed;
      try {
        parsed = text ? JSON.parse(text) : null;
      } catch {
        parsed = null;
      }
    
      if (!res.ok) {
        const apiMsg = parsed?.error || parsed?.message || text || res.statusText;
        const err = new Error(`SurfRank ${res.status}: ${apiMsg}`);
        err.status = res.status;
        err.body = parsed;
        throw err;
      }
    
      return parsed;
    }
    
    export const api = {
      get: (path, query) => request('GET', path, { query }),
      post: (path, body) => request('POST', path, { body }),
      patch: (path, body) => request('PATCH', path, { body }),
      delete: (path) => request('DELETE', path),
    };
Behavior4/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It states that the tool retrieves a quick test and specifically includes status and results, implying a read-only, non-destructive action. This is adequate for a simple retrieval tool.

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?

The description is a single sentence of 12 words, directly stating the core functionality. There is no redundancy, and every word adds value.

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

Completeness4/5

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

Given the low complexity (one parameter, no output schema, no annotations), the description covers the essential information: what the tool does and what it returns. It does not go into error handling or authentication, but for a simple GET-like operation, it is mostly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one required parameter 'testId' with no description coverage (0%). The tool description does not explain what 'testId' is, how to obtain it, or any constraints beyond the schema's type string. This forces the AI agent to infer the parameter's meaning from context, which is insufficient.

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?

The description clearly identifies the tool's action ('Get'), the resource ('a single quick test'), and the returned data ('including status and results'). It distinguishes itself from sibling tools like 'list_quick_tests' (which lists multiple) and 'run_quick_test' (which creates a new test).

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

Usage Guidelines2/5

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

The description lacks any guidance on when to use this tool versus alternatives. It does not mention prerequisites, such as needing a test ID from 'list_quick_tests' or 'run_quick_test', nor does it exclude scenarios where this tool is inappropriate.

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/SurfRankAI/mcp-server'

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