Skip to main content
Glama
247arjun
by 247arjun

curl_download

Download files from URLs using curl with options to specify output filenames, resume partial downloads, follow redirects, and set request timeouts.

Instructions

Download a file using curl

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
follow_redirectsNoWhether to follow redirects
output_filenameNoOutput filename (if not provided, will use remote filename)
resumeNoResume partial download if file exists
timeoutNoRequest timeout in seconds
urlYesThe URL of the file to download

Implementation Reference

  • The handler function that executes the curl download logic by building safe curl arguments and invoking the shared executeCurl helper.
    async ({ url, output_filename, resume, follow_redirects, timeout }) => {
      const args = ['curl'];
      
      // Add the URL
      args.push(url);
      
      // Add output option
      if (output_filename) {
        args.push('-o', output_filename);
      } else {
        args.push('-O'); // Use remote filename
      }
      
      // Add resume option
      if (resume) {
        args.push('-C', '-');
      }
      
      // Add follow redirects option
      if (follow_redirects) {
        args.push('-L');
      }
      
      // Add timeout if provided
      if (timeout) {
        args.push('--max-time', timeout.toString());
      }
      
      // Show progress
      args.push('--progress-bar');
      
      try {
        const result = await executeCurl(args);
        
        return {
          content: [
            {
              type: "text",
              text: `Exit Code: ${result.exitCode}\n\nDownload ${result.exitCode === 0 ? 'completed successfully' : 'failed'}:\n${result.stdout}${result.stderr ? `\n\nOutput:\n${result.stderr}` : ''}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error executing curl: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining the parameters for the curl_download tool.
    {
      url: z.string().describe("The URL of the file to download"),
      output_filename: z.string().optional().describe("Output filename (if not provided, will use remote filename)"),
      resume: z.boolean().optional().default(false).describe("Resume partial download if file exists"),
      follow_redirects: z.boolean().optional().default(true).describe("Whether to follow redirects"),
      timeout: z.number().optional().describe("Request timeout in seconds"),
    },
  • src/index.ts:356-419 (registration)
    The server.tool registration for the curl_download tool, including description, schema, and handler reference."},{
    server.tool(
      "curl_download",
      "Download a file using curl",
      {
        url: z.string().describe("The URL of the file to download"),
        output_filename: z.string().optional().describe("Output filename (if not provided, will use remote filename)"),
        resume: z.boolean().optional().default(false).describe("Resume partial download if file exists"),
        follow_redirects: z.boolean().optional().default(true).describe("Whether to follow redirects"),
        timeout: z.number().optional().describe("Request timeout in seconds"),
      },
      async ({ url, output_filename, resume, follow_redirects, timeout }) => {
        const args = ['curl'];
        
        // Add the URL
        args.push(url);
        
        // Add output option
        if (output_filename) {
          args.push('-o', output_filename);
        } else {
          args.push('-O'); // Use remote filename
        }
        
        // Add resume option
        if (resume) {
          args.push('-C', '-');
        }
        
        // Add follow redirects option
        if (follow_redirects) {
          args.push('-L');
        }
        
        // Add timeout if provided
        if (timeout) {
          args.push('--max-time', timeout.toString());
        }
        
        // Show progress
        args.push('--progress-bar');
        
        try {
          const result = await executeCurl(args);
          
          return {
            content: [
              {
                type: "text",
                text: `Exit Code: ${result.exitCode}\n\nDownload ${result.exitCode === 0 ? 'completed successfully' : 'failed'}:\n${result.stdout}${result.stderr ? `\n\nOutput:\n${result.stderr}` : ''}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error executing curl: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
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. 'Download a file using curl' implies a read operation, but it doesn't specify authentication needs, rate limits, error handling, or what happens on failure (e.g., partial downloads). It mentions curl but doesn't explain curl-specific behaviors like default options or security implications.

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 with no wasted words. It's front-loaded with the core action and method, making it easy to parse quickly. Every word earns its place by conveying essential information.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error cases, or behavioral nuances like how output_filename interacts with remote filenames. Given the complexity and lack of structured data, more context is needed for 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 fully documents all 5 parameters. The description adds no parameter-specific information beyond what's in the schema, such as examples or constraints. With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

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

Purpose3/5

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

The description 'Download a file using curl' clearly states the action (download) and resource (file), but it's vague about scope and doesn't differentiate from sibling tools like curl_get or curl_advanced. It specifies the method (curl) but lacks details about what kind of files or protocols are supported.

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?

No guidance is provided on when to use this tool versus alternatives like curl_get or curl_advanced. The description doesn't mention prerequisites, exclusions, or specific contexts for use, leaving the agent to infer usage from the tool name alone.

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/247arjun/mcp-curl'

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