Skip to main content
Glama
amranu

DigitalOcean MCP Server

by amranu

call_digitalocean_api

Interact with DigitalOcean API endpoints by specifying operation IDs and parameters, enabling direct API calls through the DigitalOcean MCP Server for streamlined cloud management.

Instructions

Call a DigitalOcean API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationIdYesOperation ID of the endpoint to call
parametersNoParameters for the API call

Implementation Reference

  • The main handler function for the 'call_digitalocean_api' tool. It checks if the API client is configured, resolves the endpoint using findEndpoint, calls apiClient.callEndpoint with the parameters, and returns the result formatted as MCP content.
    private async handleCallApi(args: any) {
      if (!this.apiClient) {
        throw new Error('API client not configured. Use configure_digitalocean_api first.');
      }
    
      const { operationId, parameters = {} } = args;
      
      const endpoint = findEndpoint(operationId);
      if (!endpoint) {
        throw new Error(`Endpoint not found: ${operationId}`);
      }
    
      const result = await this.apiClient.callEndpoint(endpoint, parameters);
    
      return {
        content: [
          {
            type: 'text',
            text: `API call successful:\n\n${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • The core implementation that builds the request URL, processes parameters for query/body/path, makes the axios request to DigitalOcean API, and handles errors.
    async callEndpoint(endpoint: DOEndpoint, params: Record<string, any> = {}): Promise<any> {
      const url = this.buildUrl(endpoint.path, params);
      const requestConfig: AxiosRequestConfig = {
        method: endpoint.method,
        url,
      };
    
      // Add query parameters
      const queryParams: Record<string, any> = {};
      const bodyParams: Record<string, any> = {};
    
      endpoint.parameters.forEach(param => {
        if (params[param.name] !== undefined) {
          if (param.in === 'query') {
            queryParams[param.name] = params[param.name];
          } else if (param.in === 'body' || param.in === 'formData') {
            bodyParams[param.name] = params[param.name];
          }
        }
      });
    
      if (Object.keys(queryParams).length > 0) {
        requestConfig.params = queryParams;
      }
    
      if (['POST', 'PUT', 'PATCH'].includes(endpoint.method) && Object.keys(bodyParams).length > 0) {
        requestConfig.data = bodyParams;
      }
    
      try {
        const response = await this.client.request(requestConfig);
        return response.data;
      } catch (error: any) {
        if (error.response) {
          throw new Error(`API Error: ${error.response.status} - ${error.response.data?.message || error.message}`);
        }
        throw error;
      }
    }
  • Input schema defining operationId (required) and parameters (object).
    inputSchema: {
      type: 'object',
      properties: {
        operationId: {
          type: 'string',
          description: 'Operation ID of the endpoint to call',
        },
        parameters: {
          type: 'object',
          description: 'Parameters for the API call',
          additionalProperties: true,
        },
      },
      required: ['operationId'],
    },
  • src/index.ts:128-146 (registration)
    Registration of the tool in the ListTools response, including name, description, and schema.
    {
      name: 'call_digitalocean_api',
      description: 'Call a DigitalOcean API endpoint',
      inputSchema: {
        type: 'object',
        properties: {
          operationId: {
            type: 'string',
            description: 'Operation ID of the endpoint to call',
          },
          parameters: {
            type: 'object',
            description: 'Parameters for the API call',
            additionalProperties: true,
          },
        },
        required: ['operationId'],
      },
    } as Tool,
  • src/index.ts:177-178 (registration)
    Dispatch in the CallToolRequest handler switch statement to the tool handler.
    case 'call_digitalocean_api':
      return await this.handleCallApi(args);
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. It states 'call' implies an action, but doesn't specify whether it's read-only, destructive, requires authentication, has rate limits, or what the response format might be. For a general API-calling tool with zero annotation coverage, this leaves critical behavioral traits undefined.

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 zero waste—it directly states the tool's function without fluff. It's appropriately sized for a general-purpose tool and front-loaded with the core action, 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 tool's complexity (making API calls with dynamic parameters) and lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like error handling, authentication needs, or return values, which are crucial for an agent to use this tool effectively. Siblings suggest this is part of a broader API management suite, but the description doesn't integrate that context.

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%, with clear descriptions for 'operationId' and 'parameters', so the schema does the heavy lifting. The description adds no meaning beyond this—it doesn't explain how to use 'operationId' (e.g., referencing endpoints from 'list_endpoints') or what 'parameters' might include. Baseline 3 is appropriate as the schema provides adequate documentation.

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 'Call a DigitalOcean API endpoint' states the action (call) and target (DigitalOcean API endpoint), which provides a basic purpose. However, it's vague about what 'call' entails (e.g., making HTTP requests, executing operations) and doesn't distinguish it from siblings like 'get_endpoint_details' or 'list_endpoints', which might involve similar API interactions. It avoids tautology but lacks 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. It doesn't mention prerequisites (e.g., needing configuration via 'configure_digitalocean_api'), exclusions, or comparisons to siblings like 'list_endpoints' for browsing or 'search_endpoints' for filtering. Without such context, an agent must 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/amranu/digitalocean-mcp'

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