Skip to main content
Glama
247arjun
by 247arjun

curl_get

Execute HTTP GET requests to specified URLs, configure headers, set timeouts, and manage redirects for web API interactions and content retrieval.

Instructions

Make an HTTP GET request using curl

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
follow_redirectsNoWhether to follow redirects
headersNoOptional HTTP headers in the format 'Header: Value'
timeoutNoRequest timeout in seconds
urlYesThe URL to make the GET request to
user_agentNoCustom User-Agent string

Implementation Reference

  • The handler function for the curl_get tool. It constructs the curl command arguments based on the provided parameters (url, headers, etc.) and executes it using the executeCurl helper, returning the response or error.
    async ({ url, headers, follow_redirects, timeout, user_agent }) => {
      const args = ['curl'];
      
      // Add the URL
      args.push(url);
      
      // Add headers if provided
      if (headers && headers.length > 0) {
        headers.forEach(header => {
          args.push('-H', header);
        });
      }
      
      // Add follow redirects option
      if (follow_redirects) {
        args.push('-L');
      }
      
      // Add timeout if provided
      if (timeout) {
        args.push('--max-time', timeout.toString());
      }
      
      // Add custom user agent if provided
      if (user_agent) {
        args.push('-A', user_agent);
      }
      
      // Include response headers in output
      args.push('-i');
      
      try {
        const result = await executeCurl(args);
        
        return {
          content: [
            {
              type: "text",
              text: `Exit Code: ${result.exitCode}\n\nResponse:\n${result.stdout}${result.stderr ? `\n\nErrors:\n${result.stderr}` : ''}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error executing curl: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the curl_get tool.
      url: z.string().describe("The URL to make the GET request to"),
      headers: z.array(z.string()).optional().describe("Optional HTTP headers in the format 'Header: Value'"),
      follow_redirects: z.boolean().optional().default(false).describe("Whether to follow redirects"),
      timeout: z.number().optional().describe("Request timeout in seconds"),
      user_agent: z.string().optional().describe("Custom User-Agent string"),
    },
  • src/index.ts:65-128 (registration)
    Registration of the curl_get tool using server.tool(), including name, description, schema, and handler function.
    server.tool(
      "curl_get",
      "Make an HTTP GET request using curl",
      {
        url: z.string().describe("The URL to make the GET request to"),
        headers: z.array(z.string()).optional().describe("Optional HTTP headers in the format 'Header: Value'"),
        follow_redirects: z.boolean().optional().default(false).describe("Whether to follow redirects"),
        timeout: z.number().optional().describe("Request timeout in seconds"),
        user_agent: z.string().optional().describe("Custom User-Agent string"),
      },
      async ({ url, headers, follow_redirects, timeout, user_agent }) => {
        const args = ['curl'];
        
        // Add the URL
        args.push(url);
        
        // Add headers if provided
        if (headers && headers.length > 0) {
          headers.forEach(header => {
            args.push('-H', header);
          });
        }
        
        // Add follow redirects option
        if (follow_redirects) {
          args.push('-L');
        }
        
        // Add timeout if provided
        if (timeout) {
          args.push('--max-time', timeout.toString());
        }
        
        // Add custom user agent if provided
        if (user_agent) {
          args.push('-A', user_agent);
        }
        
        // Include response headers in output
        args.push('-i');
        
        try {
          const result = await executeCurl(args);
          
          return {
            content: [
              {
                type: "text",
                text: `Exit Code: ${result.exitCode}\n\nResponse:\n${result.stdout}${result.stderr ? `\n\nErrors:\n${result.stderr}` : ''}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error executing curl: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Helper function executeCurl that safely spawns a curl child process, captures output streams and exit code. Used by all curl tools including curl_get.
    async function executeCurl(args: string[]): Promise<{ stdout: string; stderr: string; exitCode: number }> {
      return new Promise((resolve) => {
        // Ensure we're only calling curl with safe arguments
        if (!args.includes('curl')) {
          args.unshift('curl');
        }
        
        const child = spawn('curl', args.slice(1), {
          stdio: ['pipe', 'pipe', 'pipe'],
          shell: false,
        });
    
        let stdout = '';
        let stderr = '';
    
        child.stdout.on('data', (data) => {
          stdout += data.toString();
        });
    
        child.stderr.on('data', (data) => {
          stderr += data.toString();
        });
    
        child.on('close', (code) => {
          resolve({
            stdout,
            stderr,
            exitCode: code || 0,
          });
        });
    
        child.on('error', (error) => {
          resolve({
            stdout: '',
            stderr: error.message,
            exitCode: 1,
          });
        });
      });
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action but fails to describe key traits like error handling, response format, authentication needs, or rate limits. This leaves significant gaps for an agent to understand how the tool behaves beyond the basic operation.

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, clear sentence that efficiently conveys the core purpose without unnecessary words. It is front-loaded and appropriately sized, making it easy to parse 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 complexity of HTTP requests and the lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like error handling or response details, which are crucial for an agent to use the tool effectively in varied contexts.

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?

The schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond what the schema provides, such as examples or context for parameter use. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 ('Make an HTTP GET request') and the method ('using curl'), which is specific and unambiguous. However, it doesn't distinguish this tool from its sibling tools like curl_post or curl_put beyond the HTTP method, missing explicit differentiation.

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, such as curl_advanced or other sibling tools. It lacks context about scenarios where a GET request is appropriate or when other methods might be better, offering no usage instructions.

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