Skip to main content
Glama
247arjun
by 247arjun

curl_put

Send HTTP PUT requests using curl to update or replace resources on a server. Supports JSON data, custom headers, redirects, and timeouts for seamless API interactions. Ideal for modifying remote data.

Instructions

Make an HTTP PUT request using curl

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_typeNoContent-Type header (will be added automatically for JSON data)
dataNoData to send in the PUT request body
follow_redirectsNoWhether to follow redirects
headersNoOptional HTTP headers in the format 'Header: Value'
json_dataNoJSON object to send as PUT data
timeoutNoRequest timeout in seconds
urlYesThe URL to make the PUT request to

Implementation Reference

  • The main handler function for the 'curl_put' tool. Constructs curl command arguments for an HTTP PUT request, handles JSON/data payloads, headers, redirects, and timeout options, executes the command using the shared executeCurl helper, and formats the response.
    async ({ url, data, json_data, headers, content_type, follow_redirects, timeout }) => {
      const args = ['curl'];
      
      // Add the URL
      args.push(url);
      
      // Add PUT method
      args.push('-X', 'PUT');
      
      // Handle data
      if (json_data) {
        args.push('-d', JSON.stringify(json_data));
        if (!content_type) {
          content_type = 'application/json';
        }
      } else if (data) {
        args.push('-d', data);
      }
      
      // Add content type header
      if (content_type) {
        args.push('-H', `Content-Type: ${content_type}`);
      }
      
      // Add additional 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());
      }
      
      // 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)}`,
            },
          ],
        };
      }
    }
  • Input schema validation using Zod for the curl_put tool parameters: URL (required), optional data/JSON payload, headers, content-type, follow redirects, and timeout.
    {
      url: z.string().describe("The URL to make the PUT request to"),
      data: z.string().optional().describe("Data to send in the PUT request body"),
      json_data: z.record(z.any()).optional().describe("JSON object to send as PUT data"),
      headers: z.array(z.string()).optional().describe("Optional HTTP headers in the format 'Header: Value'"),
      content_type: z.string().optional().describe("Content-Type header (will be added automatically for JSON data)"),
      follow_redirects: z.boolean().optional().default(false).describe("Whether to follow redirects"),
      timeout: z.number().optional().describe("Request timeout in seconds"),
    },
  • src/index.ts:212-214 (registration)
    Registration of the 'curl_put' tool on the MCP server, specifying name and description.
    server.tool(
      "curl_put",
      "Make an HTTP PUT request using curl",
  • Shared helper function to safely spawn and execute curl subprocess, capturing stdout/stderr/exit code. Used by all curl tools including curl_put.
    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 basic action but fails to describe critical traits like error handling, authentication needs, rate limits, or what the response might contain. This is inadequate for a tool that performs HTTP operations with multiple parameters.

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 fluff. It's appropriately sized and front-loaded, making it easy for an agent 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 tool's complexity (7 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain return values, error conditions, or behavioral nuances, leaving significant gaps for an agent to understand how to use the tool effectively beyond basic syntax.

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 7 parameters. The description adds no additional meaning beyond what's in the schema, such as explaining parameter interactions (e.g., data vs. json_data). This meets the baseline for high schema coverage.

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 PUT request') and the method ('using curl'), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like curl_post or curl_delete, which would require mentioning the HTTP method specificity.

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 like curl_post or curl_advanced. It lacks context about typical PUT use cases (e.g., updating resources) or prerequisites, 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