Skip to main content
Glama
patchwindow

seo-mcp

by patchwindow

bing_crawl_health

Retrieve Bing crawl statistics and issues: view crawl frequency, error counts by type (4xx, timeouts, DNS failures, blocked), and specific crawl problems for your site.

Instructions

Get crawl statistics and crawl issues from Bing Webmaster Tools. Shows crawl frequency, error counts by type (4xx, timeouts, DNS failures, blocked), and a list of specific crawl problems.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
site_urlNoYour site URL in Bing Webmaster Tools, e.g. 'https://example.com/'. Uses config default if omitted.
show_issuesNoInclude specific crawl issues. Default: true.
max_issuesNoMax crawl issues to show. Default: 20.

Implementation Reference

  • The handler function that executes the bing_crawl_health tool logic: fetches crawl stats and issues from Bing Webmaster Tools API, formats them as text output.
    handler: async (args, config) => {
      const apiKey = getBingApiKey();
    
      const siteUrl = args.site_url ?? config.bing?.default_site;
      if (!siteUrl) {
        throw new Error(
          "site_url is required. Pass it as an argument or set bing.default_site in ~/.seo-mcp/config.json"
        );
      }
    
      const showIssues = args.show_issues ?? true;
      const maxIssues = args.max_issues ?? 20;
    
      const parts: string[] = [`Crawl health for ${siteUrl}`, ""];
    
      const statsData = (await bingGet("GetCrawlStats", { siteUrl }, apiKey)) as BingCrawlStats | null;
    
      if (statsData) {
        const total = statsData.CrawledUrls ?? 0;
        const errors = statsData.CrawlErrors ?? 0;
        const errorPct = total > 0 ? ((errors / total) * 100).toFixed(1) : "0.0";
    
        parts.push(
          "== Crawl Statistics ==",
          `Total crawled URLs: ${total}`,
          `Successful: ${statsData.CrawlSuccessUrls ?? 0}`,
          `Errors: ${errors} (${errorPct}% error rate)`,
          `  Not found (4xx): ${statsData.NotFoundUrls ?? 0}`,
          `  Network failed: ${statsData.NetworkFailedUrls ?? 0}`,
          `  Timeout: ${statsData.TimeoutUrls ?? 0}`,
          `  DNS failed: ${statsData.DnsFailedUrls ?? 0}`,
          `Redirected: ${statsData.HttpRedirectedUrls ?? 0}`,
          `Blocked: ${statsData.BlockedUrls ?? 0} (robots.txt: ${statsData.BlockedByRobotsTxtUrls ?? 0})`,
          `Crawled bytes: ${((statsData.CrawledBytes ?? 0) / 1024 / 1024).toFixed(2)} MB`
        );
    
        if (statsData.RootError) {
          parts.push("", "WARNING: Bing cannot crawl your site's root URL.");
        }
      } else {
        parts.push("No crawl statistics available.");
      }
    
      if (showIssues) {
        const issuesData = (await bingGet("GetCrawlIssues", { siteUrl }, apiKey)) as BingCrawlIssue[] | null;
        const issues = Array.isArray(issuesData) ? issuesData : [];
    
        parts.push("", "== Crawl Issues ==");
    
        if (issues.length === 0) {
          parts.push("No crawl issues reported.");
        } else {
          const shown = issues.slice(0, maxIssues);
          parts.push(`Showing ${shown.length} of ${issues.length} issues:`, "url\tissue\thttp_code\tcrawl_time");
          for (const issue of shown) {
            parts.push(
              `${issue.PageUrl ?? "—"}\t${issue.IssueName ?? "—"}\t${issue.HttpCode ?? "—"}\t${issue.CrawlTime ?? "—"}`
            );
          }
          if (issues.length > maxIssues) {
            parts.push(`... and ${issues.length - maxIssues} more issues.`);
          }
        }
      }
    
      return { content: [{ type: "text", text: parts.join("\n") }] };
    },
  • Zod schema defining input parameters: site_url (optional string), show_issues (optional boolean, default true), max_issues (optional number, default 20).
    const schema = z.object({
      site_url: z.string().optional().describe(
        "Your site URL in Bing Webmaster Tools, e.g. 'https://example.com/'. Uses config default if omitted."
      ),
      show_issues: z.boolean().optional().describe("Include specific crawl issues. Default: true."),
      max_issues: z.number().optional().describe("Max crawl issues to show. Default: 20."),
    });
  • The ToolDefinition export that registers the tool with name 'bing_crawl_health', description, schema, and handler.
    export const bingCrawlHealth: ToolDefinition<typeof schema> = {
      name: "bing_crawl_health",
      description:
        "Get crawl statistics and crawl issues from Bing Webmaster Tools. Shows crawl frequency, error counts by type (4xx, timeouts, DNS failures, blocked), and a list of specific crawl problems.",
      schema,
      handler: async (args, config) => {
        const apiKey = getBingApiKey();
    
        const siteUrl = args.site_url ?? config.bing?.default_site;
        if (!siteUrl) {
          throw new Error(
            "site_url is required. Pass it as an argument or set bing.default_site in ~/.seo-mcp/config.json"
          );
        }
    
        const showIssues = args.show_issues ?? true;
        const maxIssues = args.max_issues ?? 20;
    
        const parts: string[] = [`Crawl health for ${siteUrl}`, ""];
    
        const statsData = (await bingGet("GetCrawlStats", { siteUrl }, apiKey)) as BingCrawlStats | null;
    
        if (statsData) {
          const total = statsData.CrawledUrls ?? 0;
          const errors = statsData.CrawlErrors ?? 0;
          const errorPct = total > 0 ? ((errors / total) * 100).toFixed(1) : "0.0";
    
          parts.push(
            "== Crawl Statistics ==",
            `Total crawled URLs: ${total}`,
            `Successful: ${statsData.CrawlSuccessUrls ?? 0}`,
            `Errors: ${errors} (${errorPct}% error rate)`,
            `  Not found (4xx): ${statsData.NotFoundUrls ?? 0}`,
            `  Network failed: ${statsData.NetworkFailedUrls ?? 0}`,
            `  Timeout: ${statsData.TimeoutUrls ?? 0}`,
            `  DNS failed: ${statsData.DnsFailedUrls ?? 0}`,
            `Redirected: ${statsData.HttpRedirectedUrls ?? 0}`,
            `Blocked: ${statsData.BlockedUrls ?? 0} (robots.txt: ${statsData.BlockedByRobotsTxtUrls ?? 0})`,
            `Crawled bytes: ${((statsData.CrawledBytes ?? 0) / 1024 / 1024).toFixed(2)} MB`
          );
    
          if (statsData.RootError) {
            parts.push("", "WARNING: Bing cannot crawl your site's root URL.");
          }
        } else {
          parts.push("No crawl statistics available.");
        }
    
        if (showIssues) {
          const issuesData = (await bingGet("GetCrawlIssues", { siteUrl }, apiKey)) as BingCrawlIssue[] | null;
          const issues = Array.isArray(issuesData) ? issuesData : [];
    
          parts.push("", "== Crawl Issues ==");
    
          if (issues.length === 0) {
            parts.push("No crawl issues reported.");
          } else {
            const shown = issues.slice(0, maxIssues);
            parts.push(`Showing ${shown.length} of ${issues.length} issues:`, "url\tissue\thttp_code\tcrawl_time");
            for (const issue of shown) {
              parts.push(
                `${issue.PageUrl ?? "—"}\t${issue.IssueName ?? "—"}\t${issue.HttpCode ?? "—"}\t${issue.CrawlTime ?? "—"}`
              );
            }
            if (issues.length > maxIssues) {
              parts.push(`... and ${issues.length - maxIssues} more issues.`);
            }
          }
        }
    
        return { content: [{ type: "text", text: parts.join("\n") }] };
      },
    };
  • Re-exports bingCrawlHealth in the bingTools array for registration as an MCP tool.
    import { bingKeywordResearch } from "./keyword-research.js";
    import { bingCrawlHealth } from "./crawl-health.js";
    import { bingUrlInspection } from "./url-inspection.js";
    import { bingSitemapList } from "./sitemap-list.js";
    import type { ToolDefinition } from "../../types/tool.js";
    
    export const bingTools: ToolDefinition[] = [
      bingKeywordResearch as unknown as ToolDefinition,
      bingCrawlHealth as unknown as ToolDefinition,
      bingUrlInspection as unknown as ToolDefinition,
      bingSitemapList as unknown as ToolDefinition,
    ];
  • The bingGet helper function used by the handler to make authenticated GET requests to the Bing Webmaster Tools API.
    export async function bingGet(
      method: string,
      params: Record<string, string | number | undefined>,
      apiKey: string
    ): Promise<unknown> {
      const url = new URL(`${BING_BASE_URL}/${method}`);
      url.searchParams.set("apikey", apiKey);
    
      for (const [k, v] of Object.entries(params)) {
        if (v !== undefined) url.searchParams.set(k, String(v));
      }
    
      const res = await fetch(url.toString(), {
        headers: { Accept: "application/json" },
      });
    
      if (!res.ok) {
        const body = await res.text().catch(() => "");
        throw new Error(`Bing API error ${res.status} on ${method}: ${body}`);
      }
    
      const json = (await res.json()) as { d?: unknown };
      return json.d ?? json;
    }
Behavior3/5

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

No annotations are provided, so the description must carry the full burden. It mentions what data is returned (crawl frequency, error types, problem list) but does not disclose behavioral aspects like authentication needs, rate limits, error handling, or side effects. The verb 'Get' implies read-only, but this is not explicit.

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 sentences with front-loaded purpose and specific details. Zero wasted words, efficiently communicates core functionality.

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?

The description adequately covers the tool's purpose and key output for a 3-parameter tool with no output schema. However, it lacks details on return format or error conditions. Given the absence of output schema, a bit more on expected results would improve completeness.

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 description coverage is 100%, with clear parameter descriptions (site_url, show_issues, max_issues). The tool description adds context about what the parameters control (e.g., 'specific crawl issues') but does not provide additional meaning beyond what the schema already conveys. Baseline 3 is appropriate.

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 states verb 'Get' and resource 'crawl statistics and crawl issues' from Bing Webmaster Tools, listing specific metrics (crawl frequency, error counts by type, crawl problems). It distinctly differentiates from sibling tools like bing_keyword_research or bing_sitemap_list, which focus on other data.

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

Usage Guidelines3/5

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

The description implies the tool is for retrieving crawl health data but provides no explicit when-to-use or when-not-to-use guidance versus siblings. No prerequisites or context are given, leaving the agent to infer from the function name and resource.

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/patchwindow/seo-mcp'

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