Skip to main content
Glama
pskill9

Website Downloader

by pskill9

download_website

Use wget to download an entire website, preserving its structure and converting links for local use. Specify URL, output path (optional), and depth level for recursive downloads.

Instructions

Download an entire website using wget

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthNoMaximum depth level for recursive downloading (optional, defaults to infinite)
outputPathNoPath where the website should be downloaded (optional, defaults to current directory)
urlYesURL of the website to download

Implementation Reference

  • The tool handler registered for CallToolRequestSchema. It validates arguments, checks for wget, constructs and executes a wget command to download the website recursively with specified options, and returns success/error content.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      if (request.params.name !== 'download_website') {
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unknown tool: ${request.params.name}`
        );
      }
    
      if (!isValidDownloadArgs(request.params.arguments)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid download arguments'
        );
      }
    
      const { url, outputPath = process.cwd(), depth } = request.params.arguments;
    
      try {
        // Check if wget is installed
        await execAsync('which wget');
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error downloading website: ${error.message || 'Unknown error'}`
            },
          ],
          isError: true,
        };
      }
    
      try {
        // Create wget command with options for downloading website
        const wgetCommand = [
          'wget',
          '--recursive',              // Download recursively
          `--level=${depth !== undefined ? depth : 'inf'}`,  // Recursion depth (infinite if not specified)
          '--page-requisites',       // Get all assets needed to display the page
          '--convert-links',         // Convert links to work locally
          '--adjust-extension',      // Add appropriate extensions to files
          '--span-hosts',            // Include necessary resources from other hosts
          '--domains=' + new URL(url).hostname,  // Restrict to same domain
          '--no-parent',             // Don't follow links to parent directory
          '--directory-prefix=' + outputPath,  // Output directory
          url
        ].join(' ');
    
        const { stdout, stderr } = await execAsync(wgetCommand);
        
        return {
          content: [
            {
              type: 'text',
              text: `Website downloaded successfully to ${outputPath}\n\nOutput:\n${stdout}\n${stderr}`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error downloading website: ${error.message || 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    });
  • Input schema definition for the download_website tool, defining parameters url (required), outputPath, and depth.
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'URL of the website to download',
        },
        outputPath: {
          type: 'string',
          description: 'Path where the website should be downloaded (optional, defaults to current directory)',
        },
        depth: {
          type: 'number',
          description: 'Maximum depth level for recursive downloading (optional, defaults to infinite)',
          minimum: 0
        }
      },
      required: ['url'],
    },
  • src/index.ts:55-81 (registration)
    Registration of the download_website tool in the ListToolsRequestSchema handler, including name, description, and schema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'download_website',
          description: 'Download an entire website using wget',
          inputSchema: {
            type: 'object',
            properties: {
              url: {
                type: 'string',
                description: 'URL of the website to download',
              },
              outputPath: {
                type: 'string',
                description: 'Path where the website should be downloaded (optional, defaults to current directory)',
              },
              depth: {
                type: 'number',
                description: 'Maximum depth level for recursive downloading (optional, defaults to infinite)',
                minimum: 0
              }
            },
            required: ['url'],
          },
        },
      ],
    }));
  • Helper function to validate the arguments for download_website tool.
    const isValidDownloadArgs = (args: any): args is DownloadWebsiteArgs =>
      typeof args === 'object' &&
      args !== null &&
      typeof args.url === 'string' &&
      (args.outputPath === undefined || typeof args.outputPath === 'string') &&
      (args.depth === undefined || (typeof args.depth === 'number' && args.depth >= 0));
  • TypeScript interface defining the expected arguments for the download_website tool.
    interface DownloadWebsiteArgs {
      url: string;
      outputPath?: string;
      depth?: number;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions using wget, which implies network operations and file system writes, but doesn't specify potential side effects like data consumption, rate limits, or file overwriting risks. This leaves significant gaps in understanding the tool's behavior.

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 directly states the tool's purpose without any unnecessary words. It is front-loaded and appropriately sized, making it easy to understand quickly.

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

Completeness2/5

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

Given the tool's complexity (downloading entire websites with potential network and file system impacts), no annotations, and no output schema, the description is insufficient. It lacks details on return values, error handling, or operational constraints, leaving the agent with incomplete information for safe and effective use.

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 all parameters thoroughly. The description adds no additional meaning or context beyond what the schema provides, such as explaining how depth affects recursion or outputPath usage. Thus, it meets the baseline for high schema coverage without adding value.

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

Purpose4/5

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

The description clearly states the action ('download') and resource ('an entire website'), specifying the method ('using wget'). It distinguishes the tool's scope as downloading entire websites, which is specific. However, without sibling tools, it doesn't need to differentiate from alternatives, so it doesn't reach the highest score.

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 provides no guidance on when to use this tool versus alternatives or any context for its application. It lacks information about prerequisites, such as internet connectivity or permissions, and doesn't mention any exclusions or best practices for usage.

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

Related 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/pskill9/website-downloader'

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