Skip to main content
Glama
liliangshan

mcp-server-apidebug

by liliangshan

default_api_help

Retrieve detailed documentation and examples for all API debugging tools. Understand how to use api_debug, api_login, api_config, and api_execute effectively.

Instructions

API help tool that provides detailed documentation and examples for all API debugging tools. Use this to understand how to use api_debug, api_login, api_config, and api_execute tools effectively

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toolNoSpecific tool name to get help for (optional: api_debug, api_login, api_config, api_execute)

Implementation Reference

  • The main handler function for the 'default_api_help' tool. Accepts a 'tool' parameter to return documentation for a specific tool (api_debug, api_login, api_config, api_execute) or all tools by default. Returns help content with descriptions, examples, and best practices.
    async function api_help(params, config, saveConfig) {
      const { tool } = params || {};
      
      const helpContent = {
        api_debug: {
          name: 'api_debug',
          description: 'API Debug Tool - Direct API request execution',
          usage: 'Directly pass URL and parameters to execute API requests without complex action parameters',
          supportedFormats: [
            'JSON Object: {"username": "admin", "password": "123456"}',
            'Form Data: "username=admin&password=123456"',
            'Plain Text: "Hello World"',
            'XML: "<user><name>John</name><email>john@example.com</email></user>"',
            'HTML: "<html><body>Content</body></html>"'
          ],
          autoContentTypeDetection: {
            'JSON Object': 'application/json',
            'Form Data': 'application/x-www-form-urlencoded',
            'XML': 'application/xml',
            'HTML': 'text/html',
            'Plain Text': 'text/plain'
          },
          examples: [
            {
              description: 'Simple GET request',
              request: {
                url: '/api/users',
                method: 'GET',
                query: { page: 1, limit: 10 }
              }
            },
            {
              description: 'POST request with JSON body',
              request: {
                url: '/api/login',
                method: 'POST',
                body: { username: 'admin', password: '123456' },
                headers: { 'Content-Type': 'application/json' }
              }
            },
            {
              description: 'PUT request with form data',
              request: {
                url: '/api/users/123',
                method: 'PUT',
                body: 'name=John&email=john@example.com',
                contentType: 'application/x-www-form-urlencoded'
              }
            },
            {
              description: 'DELETE request with authentication',
              request: {
                url: '/api/users/123',
                method: 'DELETE',
                headers: { 'Authorization': 'Bearer token123' }
              }
            }
          ],
          bestPractices: [
            'Use relative URLs: /api/endpoint instead of full URLs',
            'Set baseUrl through api_config tool',
            'Let the tool auto-detect content type unless you have special needs',
            'Use query parameters for GET requests instead of body',
            'Set authentication information through headers parameter'
          ]
        },
        api_login: {
          name: 'api_login',
          description: 'API Login Tool - Authentication using environment variables',
          usage: 'No parameters required, directly gets login information from environment variables',
          environmentVariables: {
            'API_DEBUG_LOGIN_URL': 'Login API URL (default: /api/login)',
            'API_DEBUG_LOGIN_METHOD': 'Login request method (default: POST)',
            'API_DEBUG_LOGIN_BODY': 'Login request body template (supports JSON and string formats)',
            'API_DEBUG_LOGIN_DESCRIPTION': 'Login API description'
          },
          features: [
            'Automatically gets login configuration from environment variables',
            'Supports JSON and string formats for login body',
            'Automatically extracts token and updates Authorization header',
            'Supports custom baseUrl parameter'
          ],
          examples: [
            {
              description: 'Basic login (using environment variable configuration)',
              request: {}
            },
            {
              description: 'Login with specified baseUrl',
              request: {
                baseUrl: 'https://api.example.com'
              }
            }
          ]
        },
        api_config: {
          name: 'api_config',
          description: 'API Configuration Management Tool - Manage global API configuration',
          usage: 'Use action parameter to specify operation type',
          actions: {
            'get': 'Get current configuration',
            'set': 'Set complete configuration',
            'updateBaseUrl': 'Update base URL',
            'updateHeaders': 'Update request headers',
            'deleteHeader': 'Delete specified header',
            'addApi': 'Add API endpoint',
            'search': 'Search APIs',
            'list': 'List all APIs'
          },
          examples: [
            {
              description: 'Get configuration',
              request: { action: 'get' }
            },
            {
              description: 'Update base URL',
              request: { 
                action: 'updateBaseUrl', 
                baseUrl: 'https://api.example.com' 
              }
            },
            {
              description: 'Update request headers',
              request: { 
                action: 'updateHeaders', 
                headers: { 'Authorization': 'Bearer token123' } 
              }
            },
            {
              description: 'Search APIs',
              request: { 
                action: 'search', 
                keyword: 'user' 
              }
            },
            {
              description: 'Add API endpoint',
              request: { 
                action: 'addApi', 
                api: {
                  url: '/api/users',
                  method: 'GET',
                  description: 'Get user list',
                  query: { page: 1, limit: 10 }
                }
              }
            }
          ]
        },
        api_execute: {
          name: 'api_execute',
          description: 'API Execute Tool - Execute configured APIs by index',
          usage: 'Use index parameter to specify API index, optional overrides parameter to override configuration',
          parameters: {
            index: 'API index (required, non-negative integer)',
            overrides: 'Override parameters (optional object)'
          },
          overrides: {
            url: 'Override API URL',
            method: 'Override HTTP method',
            headers: 'Override or add request headers',
            query: 'Override query parameters',
            body: 'Override request body',
            contentType: 'Override content type'
          },
          examples: [
            {
              description: 'Execute API at index 0',
              request: { index: 0 }
            },
            {
              description: 'Execute API at index 1 with method override',
              request: { 
                index: 1, 
                overrides: { method: 'POST' }
              }
            },
            {
              description: 'Execute API with body and header overrides',
              request: { 
                index: 2, 
                overrides: { 
                  method: 'PUT',
                  body: { name: 'New Name' },
                  headers: { 'Content-Type': 'application/json' }
                }
              }
            }
          ]
        }
      };
      
      if (tool && helpContent[tool]) {
        return {
          success: true,
          tool: helpContent[tool],
          timestamp: new Date().toISOString()
        };
      } else {
        return {
          success: true,
          message: 'API Debugging Tools Help Documentation',
          tools: helpContent,
          quickStart: {
            '1. Set Configuration': 'Use api_config tool to set baseUrl and headers',
            '2. Add APIs': 'Use api_config tool with addApi action to add API endpoints',
            '3. Login Authentication': 'Use api_login tool for authentication (if needed)',
            '4. Execute APIs': 'Use api_execute tool to execute APIs by index, or use api_debug tool for direct execution',
            '5. View Help': 'Use api_help tool to view detailed documentation'
          },
          timestamp: new Date().toISOString()
        };
      }
    }
  • The schema/input definition for the 'api_help' tool registered via MCP. Defines the 'tool' property as an optional string parameter with example values: api_debug, api_login, api_config, api_execute.
    {
      name: createToolName('api_help'),
      description: 'API help tool that provides detailed documentation and examples for all API debugging tools. Use this to understand how to use api_debug, api_login, api_config, and api_execute tools effectively',
      inputSchema: {
        type: 'object',
        properties: {
          tool: {
            type: 'string',
            description: 'Specific tool name to get help for (optional: api_debug, api_login, api_config, api_execute)',
            examples: ['api_debug', 'api_login', 'api_config', 'api_execute']
          }
        }
      }
  • src/server.js:57-62 (registration)
    The createToolName helper function that prepends the TOOL_PREFIX (default: 'default') to tool names. This causes 'api_help' to become 'default_api_help' when the TOOL_PREFIX is 'default'.
    const createToolName = (name) => {
      const toolPrefix = process.env.TOOL_PREFIX || 'default';
      return toolPrefix ? `${toolPrefix}_${name}` : name;
    };
    
    const toolDefinitions = () => [
  • src/server.js:62-233 (registration)
    The toolDefinitions array that registers all MCP tools including the api_help tool definition with its name, description, and input schema.
    const toolDefinitions = () => [
      {
        name: createToolName('api_login'),
        description: 'API login authentication tool that uses environment variables for login credentials. Automatically extracts token from response and updates Authorization headers. Example: Call with optional baseUrl parameter to override default base URL',
        inputSchema: {
          type: 'object',
          properties: {
            baseUrl: {
              type: 'string',
              description: 'Base URL for login request (optional, will override config baseUrl)'
            }
          }
        }
      },
      {
        name: createToolName('api_debug'),
        description: 'API debugging tool for directly executing API requests with automatic content-type detection and flexible body format support. Examples: GET /api/users with query params, POST /api/login with JSON body {"username":"admin","password":"123456"}, PUT /api/users/123 with form data "name=John&email=john@example.com"',
        inputSchema: {
          type: 'object',
          properties: {
            url: {
              type: 'string',
              description: 'API URL to execute (required)',
              examples: ['/api/users', 'https://api.example.com/users', '/api/login']
            },
            method: {
              type: 'string',
              enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
              description: 'HTTP method (optional, defaults to GET)',
              examples: ['GET', 'POST', 'PUT']
            },
            headers: {
              type: 'object',
              description: 'Additional headers for the request (optional)',
              examples: [
                { 'Authorization': 'Bearer token123' },
                { 'Content-Type': 'application/json' },
                { 'X-API-Key': 'your-api-key' }
              ]
            },
            query: {
              type: 'object',
              description: 'Query parameters (optional)',
              examples: [
                { 'page': 1, 'limit': 10 },
                { 'search': 'keyword', 'sort': 'name' },
                { 'id': 123, 'status': 'active' }
              ]
            },
            body: {
              description: 'Request body (optional) - Supports multiple formats: JSON object, form data, XML, HTML or plain text',
              examples: [
                'JSON Object: {"username": "admin", "password": "123456"}',
                'Form Data: "username=admin&password=123456"',
                'Plain Text: "Hello World"',
                'XML: "<user><name>John</name><email>john@example.com</email></user>"'
              ]
            },
            contentType: {
              type: 'string',
              description: 'Content-Type for request body (optional, will auto-detect if not specified)',
              examples: [
                'application/json',
                'application/x-www-form-urlencoded',
                'text/plain',
                'application/xml',
                'text/html'
              ]
            }
          }
        }
      },
      {
        name: createToolName('api_help'),
        description: 'API help tool that provides detailed documentation and examples for all API debugging tools. Use this to understand how to use api_debug, api_login, api_config, and api_execute tools effectively',
        inputSchema: {
          type: 'object',
          properties: {
            tool: {
              type: 'string',
              description: 'Specific tool name to get help for (optional: api_debug, api_login, api_config, api_execute)',
              examples: ['api_debug', 'api_login', 'api_config', 'api_execute']
            }
          }
        }
      },
      {
        name: createToolName('api_execute'),
        description: 'Execute API requests by index from configured API list. Examples: execute API at index 0, execute with overrides {"method":"POST","body":{"key":"value"}}',
        inputSchema: {
          type: 'object',
          properties: {
            index: {
              type: 'number',
              description: 'Index of the API to execute from the configured list (required)',
              minimum: 0
            },
            overrides: {
              type: 'object',
              description: 'Optional parameters to override the configured API settings',
              properties: {
                url: { type: 'string', description: 'Override the API URL' },
                method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], description: 'Override the HTTP method' },
                headers: { type: 'object', description: 'Override or add request headers' },
                query: { type: 'object', description: 'Override query parameters' },
                body: { description: 'Override request body' },
                contentType: { type: 'string', description: 'Override content type' }
              }
            }
          },
          required: ['index']
        }
      },
      {
        name: createToolName('api_config'),
        description: 'API configuration management tool for managing API settings, endpoints, and configurations. Examples: get config, set baseUrl to "https://api.example.com", updateHeaders with {"Authorization":"Bearer token"}, search APIs by keyword, list all configured APIs',
        inputSchema: {
          type: 'object',
          properties: {
            action: {
              type: 'string',
              enum: ['get', 'set', 'updateBaseUrl', 'updateHeaders', 'deleteHeader', 'addApi', 'search', 'list'],
              description: 'Action to perform: "get" to retrieve config, "set" to update config, "updateBaseUrl" to update base URL, "updateHeaders" to update headers, "deleteHeader" to delete header, "addApi" to add API endpoint, "search" to search APIs, "list" to list all APIs'
            },
            config: {
              type: 'object',
              description: 'API configuration (required for "set" action)',
              properties: {
                baseUrl: { type: 'string', description: 'Base URL for API requests' },
                headers: { type: 'object', description: 'Common headers for all requests' },
                list: {
                  type: 'array',
                  description: 'List of API endpoints',
                  items: {
                    type: 'object',
                    properties: {
                      description: { type: 'string', description: 'API description' },
                      url: { type: 'string', description: 'API endpoint URL' },
                      method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], description: 'HTTP method' },
                      query: { type: 'object', description: 'Query parameters' },
                      body: { description: 'Request body' },
                      contentType: { type: 'string', description: 'Content-Type for request body' },
                      header: { type: 'object', description: 'Additional headers for this specific request' }
                    },
                    required: ['url']
                  }
                }
              }
            },
            baseUrl: { type: 'string', description: 'New base URL (required for "updateBaseUrl" action)' },
            headers: { type: 'object', description: 'New headers to add or update (required for "updateHeaders" action)' },
            headerName: { type: 'string', description: 'Name of header to delete (required for "deleteHeader" action)' },
            api: {
              type: 'object',
              description: 'API configuration (required for "addApi" action)',
              properties: {
                url: { type: 'string', description: 'API endpoint URL' },
                method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], description: 'HTTP method' },
                description: { type: 'string', description: 'API description' },
                query: { type: 'object', description: 'Query parameters' },
                body: { description: 'Request body' },
                contentType: { type: 'string', description: 'Content-Type for request body' },
                header: { type: 'object', description: 'Additional headers for this specific request' }
              },
              required: ['url']
            },
            keyword: { type: 'string', description: 'Search keyword (required for "search" action)' }
          },
          required: ['action']
        }
      }
    ];
  • src/server.js:305-323 (registration)
    The tools/list and tools/call handler in handleRequest. tools/list returns the tool definitions. tools/call strips the prefix (e.g., 'default_') from the tool name and dispatches to the class method (e.g., api_help).
    } else if (method === 'tools/list') {
      result = { tools: toolDefinitions() };
    } else if (method === 'tools/call') {
      const { name, arguments: args } = params || {};
      if (!name) {
        throw new Error('Missing tool name');
      }
    
      const toolPrefix = process.env.TOOL_PREFIX || 'default';
      const actualToolName = toolPrefix && name.startsWith(`${toolPrefix}_`)
        ? name.substring(toolPrefix.length + 1)
        : name;
    
      if (!this[actualToolName]) {
        throw new Error(`Unknown tool: ${name}`);
      }
    
      const toolResult = await this[actualToolName](args || {});
Behavior4/5

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

With no annotations, the description carries full burden. It correctly indicates the tool is purely informational (providing documentation/examples) with no side effects. While it doesn't explicitly state 'read-only' or 'no mutations', the nature of a help tool is transparent.

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?

Two sentences: the first states the purpose, the second gives usage guidance. No redundant words. Front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple help tool with one optional parameter and no output schema, the description is complete: it explains the tool's role and how to use it. It could briefly mention the format of returned help, but the current description is sufficient for its simplicity.

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 coverage is 100% and the schema already provides a clear description and examples for the 'tool' parameter. The tool description mentions the same tool names but does not add new semantic meaning beyond what the schema provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool provides 'detailed documentation and examples' for specific sibling tools (api_debug, api_login, api_config, api_execute). It uses a specific verb ('provides') and resource, effectively distinguishing its purpose as a help resource.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells when to use the tool ('Use this to understand how to use ... tools effectively'), providing clear context. It does not mention when not to use or provide alternative tools, but the context is clear enough for a help tool.

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

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/liliangshan/mcp-server-apidebug'

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