Skip to main content
Glama

api_put

Send data updates to an API endpoint using the PUT method. Specify the URL, JSON data, and headers to modify server-side resources efficiently.

Instructions

Perform a PUT request to an API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesRequest body data (JSON string)
headersNoRequest headers
urlYesAPI endpoint URL

Implementation Reference

  • The handler function that implements the core logic of the 'api_put' tool by performing a PUT request using the API client.
    async function handleApiPut(client: APIRequestContext, args: any): Promise<{ toolResult: CallToolResult }> {
      try {
        const options = {
          data: args.data,
          headers: args.headers || { 'Content-Type': 'application/json' }
        };
    
        const response = await client.put(args.url, options);
        const responseData = await getResponseData(response);
    
        return {
          toolResult: {
            content: [
              {
                type: "text",
                text: `PUT ${args.url} - Status: ${response.status()}`,
              },
              ...responseData
            ],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `PUT request failed: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
  • The tool schema definition including name, description, and input validation schema for 'api_put'.
    {
      name: "api_put",
      description: "Perform a PUT request to an API endpoint",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string", description: "API endpoint URL" },
          data: { type: "string", description: "Request body data (JSON string)" },
          headers: { 
            type: "object", 
            description: "Request headers",
            additionalProperties: { type: "string" }
          }
        },
        required: ["url", "data"]
      }
  • The dispatch/registration case in the main executeTool function that maps the 'api_put' tool name to its handler.
    case "api_put":
      return await handleApiPut(apiClient!, args);
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 states the action but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what the response might look like. For a tool that performs HTTP operations, this leaves significant gaps in understanding its behavior and constraints.

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, direct sentence that efficiently conveys the core action without any unnecessary words. It's front-loaded with the key information and has zero waste, making it highly concise and well-structured for quick understanding.

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 performing HTTP PUT requests and the lack of annotations and output schema, the description is incomplete. It doesn't address authentication, error handling, response formats, or typical use cases, which are essential for an AI agent to use this tool effectively in real-world scenarios.

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 input schema has 100% description coverage, clearly documenting the 'url', 'data', and 'headers' parameters. The description doesn't add any meaning beyond what the schema provides, such as examples or usage tips for the parameters. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 ('Perform a PUT request') and the target ('to an API endpoint'), which is a specific verb+resource combination. However, it doesn't differentiate from its sibling tools like api_post or api_patch, which perform similar HTTP operations with different methods, leaving some ambiguity about when to choose PUT specifically.

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 api_post, api_patch, or api_delete. It lacks context about typical use cases for PUT requests (e.g., updating or replacing resources) and doesn't mention prerequisites like authentication or endpoint availability.

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/imprvhub/mcp-browser-agent'

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