Skip to main content
Glama

fetch_robots

Fetch and analyze a website's robots.txt file to determine which AI bots are blocked or allowed, helping website owners control AI crawler access.

Instructions

Fetch and analyze a robots.txt file from a URL. Returns which AI bots are blocked or allowed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe website URL to fetch robots.txt from (e.g. https://example.com)

Implementation Reference

  • The implementation of the `fetch_robots` tool handler, which fetches a robots.txt file, parses it, and analyzes bot statuses.
    server.tool(
      "fetch_robots",
      "Fetch and analyze a robots.txt file from a URL. Returns which AI bots are blocked or allowed.",
      {
        url: z
          .string()
          .url()
          .describe(
            "The website URL to fetch robots.txt from (e.g. https://example.com)"
          ),
      },
      async ({ url }) => {
        try {
          // Normalize URL to get robots.txt
          const parsedUrl = new URL(url);
          const robotsUrl = `${parsedUrl.protocol}//${parsedUrl.host}/robots.txt`;
    
          const response = await fetch(robotsUrl, {
            headers: {
              "User-Agent": "robotstxt-ai-mcp/1.0",
            },
            signal: AbortSignal.timeout(10000),
          });
    
          if (!response.ok) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Failed to fetch robots.txt from ${robotsUrl}: HTTP ${response.status} ${response.statusText}`,
                },
              ],
            };
          }
    
          const content = await response.text();
          const parsed = parseRobotsTxt(content);
          const statuses = analyzeBots(parsed);
    
          const sitemapInfo =
            parsed.sitemaps.length > 0
              ? `\n## Sitemaps Found\n${parsed.sitemaps.map((s) => `- ${s}`).join("\n")}`
              : "";
    
          return {
            content: [
              {
                type: "text" as const,
                text: `# robots.txt Analysis for ${parsedUrl.host}\n\n${formatBotAnalysis(statuses)}${sitemapInfo}\n\n## Raw robots.txt\n\`\`\`\n${content}\n\`\`\``,
              },
            ],
          };
        } catch (error) {
          const message =
            error instanceof Error ? error.message : String(error);
          return {
            content: [
              {
                type: "text" as const,
                text: `Error fetching robots.txt from ${url}: ${message}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions fetching and analyzing, but lacks details on behavioral traits such as error handling (e.g., if URL is invalid or robots.txt missing), rate limits, authentication needs, or whether it's a read-only operation. The description does not contradict 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?

The description is a single, efficient sentence that front-loads the core action ('fetch and analyze') and outcome ('returns which AI bots are blocked or allowed'), with zero wasted words. It is appropriately sized for the tool's complexity.

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

Completeness3/5

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

Given no annotations and no output schema, the description is moderately complete for a simple tool with one parameter. It covers purpose and output but lacks behavioral context (e.g., error cases) and detailed usage guidance, which could be important for an AI agent invoking it correctly.

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%, so the schema already documents the 'url' parameter fully. The description adds no additional meaning beyond what the schema provides (e.g., no extra context on URL format or constraints), meeting the baseline for high coverage.

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 the tool's purpose with specific verbs ('fetch and analyze') and resource ('robots.txt file from a URL'), and distinguishes it from siblings by specifying the output ('which AI bots are blocked or allowed'). It goes beyond a tautology by explaining the analysis component.

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 usage when needing to check AI bot permissions from a robots.txt file, but does not explicitly state when to use this tool versus alternatives like 'analyze_robots' or 'check_bot_status'. No exclusions or prerequisites are mentioned.

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/sharozdawa/robotstxt-ai'

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