Skip to main content
Glama
gabrielmaialva33

MCP Filesystem Server

curl_request

Send HTTP requests to external APIs by specifying URL, method, headers, and data. Integrate with external services effectively using this tool within the MCP Filesystem Server.

Instructions

Execute a curl request to an external HTTP API. Allows specifying URL, method, headers, and data. Useful for integrating with external services via HTTP.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoData to send in the request body
followRedirectsNoWhether to follow redirects
headersNoHTTP headers to include in the request
insecureNoWhether to skip SSL certificate verification (use with caution)
methodNoHTTP methodGET
timeoutNoRequest timeout in seconds
urlYesFull URL to send the request to

Implementation Reference

  • The main handler function that constructs a curl command from the provided arguments and executes it using the bash_execute tool.
    export async function handleCurlRequest(args: CurlRequestArgs, config: Config) {
      try {
        const { url, method, headers, data, timeout, followRedirects, insecure } = args
    
        // Build curl command with appropriate options
        let command = `curl -X ${method} `
    
        // Add headers
        Object.entries(headers).forEach(([key, value]) => {
          command += `-H "${key}: ${value}" `
        })
    
        // Add data if present
        if (data) {
          command += `-d '${data}' `
        }
    
        // Add additional options
        command += `-s ` // Silent mode but show error messages
        command += `--connect-timeout ${timeout} `
    
        if (followRedirects) {
          command += `-L `
        }
    
        if (insecure) {
          command += `-k `
        }
    
        // Add URL (should be last)
        command += `"${url}"`
    
        // Log the command (without sensitive headers like Authorization)
        const logCommand = command.replace(
          /-H "Authorization: [^"]*"/,
          '-H "Authorization: [REDACTED]"'
        )
        await logger.debug(`Executing curl request: ${logCommand}`)
    
        // Execute the command using bash_execute
        const result = await handleBashExecute({ command, timeout: timeout * 1000 }, config)
    
        return result
      } catch (error) {
        await logger.error('Error executing curl request', { error })
        throw error
      }
    }
  • Zod schema defining the input parameters for the curl_request tool, including URL, method, headers, body data, and various curl options.
    export const CurlRequestArgsSchema = z.object({
      url: z.string().describe('Full URL to send the request to'),
      method: z
        .enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'])
        .default('GET')
        .describe('HTTP method'),
      headers: z
        .record(z.string(), z.string())
        .optional()
        .default({})
        .describe('HTTP headers to include in the request'),
      data: z.string().optional().describe('Data to send in the request body'),
      timeout: z.number().positive().optional().default(30).describe('Request timeout in seconds'),
      followRedirects: z.boolean().optional().default(true).describe('Whether to follow redirects'),
      insecure: z
        .boolean()
        .optional()
        .default(false)
        .describe('Whether to skip SSL certificate verification (use with caution)'),
    })
  • src/index.ts:372-378 (registration)
    Tool registration in the listTools response, defining the name, description, and input schema for curl_request.
      name: 'curl_request',
      description:
        'Execute a curl request to an external HTTP API. ' +
        'Allows specifying URL, method, headers, and data. ' +
        'Useful for integrating with external services via HTTP.',
      inputSchema: zodToJsonSchema(CurlRequestArgsSchema) as ToolInput,
    },
  • src/index.ts:765-774 (registration)
    Dispatcher case in the main CallToolRequest handler that validates arguments using the schema and delegates to the handleCurlRequest function.
    case 'curl_request': {
      const parsed = CurlRequestArgsSchema.safeParse(a)
      if (!parsed.success) {
        throw new FileSystemError(`Invalid arguments for ${name}`, 'INVALID_ARGS', undefined, {
          errors: parsed.error.format(),
        })
      }
    
      return await handleCurlRequest(parsed.data, config)
    }
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. It mentions 'Execute a curl request' which implies a network operation, but lacks details on behavioral traits such as error handling, retries, rate limits, authentication requirements, or what happens on failure. The description is minimal and doesn't compensate for the absence of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded with the core purpose in the first sentence. The second sentence adds useful context about parameters and usage. There's no wasted text, though it could be slightly more detailed given the lack of annotations.

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 (7 parameters, network operation) and no annotations or output schema, the description is incomplete. It doesn't explain return values, error cases, or important behavioral aspects like security implications of 'insecure' parameter. For a tool that executes HTTP requests, more context is needed to guide 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 minimal value beyond the schema by listing 'URL, method, headers, and data' as key parameters, but doesn't provide additional semantics or usage examples. Baseline 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose: 'Execute a curl request to an external HTTP API.' It specifies the action (execute) and resource (curl request/HTTP API). However, it doesn't explicitly differentiate from sibling tools like 'bash_execute' or 'execute_command' which might also execute commands, though those appear to be for shell commands rather than HTTP requests.

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 provides implied usage guidance: 'Useful for integrating with external services via HTTP.' This suggests when to use it (for HTTP integration), but it doesn't explicitly state when not to use it or name alternatives among siblings. For example, it doesn't clarify if 'bash_execute' could be used for similar purposes with curl commands.

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/gabrielmaialva33/mcp-filesystem'

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