Skip to main content
Glama

api_post

Send HTTP POST requests to any URL with customizable headers and body content. Integrate external APIs directly into AI workflows using the MCP API Server.

Instructions

Make an HTTP POST request to the specified URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNoThe request body (string or JSON object)
headersNoOptional headers to include in the request
urlYesThe URL to make the POST request to

Implementation Reference

  • Core handler function that executes the api_post tool logic by making an HTTP POST request using axios.
    async post( url: string, body?: string | object, headers?: Record<string, string> ): Promise<APIResponse | ErrorResponse> { return this.makeRequest({ url, method: 'POST', body, headers, }); }
  • MCP tool definition including name, description, and input schema for api_post.
    export const API_POST_TOOL: MCPTool = { name: 'api_post', description: 'Make an HTTP POST request to the specified URL', inputSchema: { type: 'object', properties: { url: { type: 'string', format: 'uri', description: 'The URL to make the POST request to', }, body: { oneOf: [ { type: 'string' }, { type: 'object' }, ], description: 'The request body (string or JSON object)', }, headers: { type: 'object', description: 'Optional headers to include in the request', additionalProperties: { type: 'string', }, }, }, required: ['url'], }, };
  • Registers the list_tools MCP handler which returns all tools including api_post via ALL_API_TOOLS.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { this.log('Received list_tools request'); return { tools: ALL_API_TOOLS, }; });
  • src/tools.ts:138-142 (registration)
    Registers api_post in the TOOL_MAP used for tool lookup and validation in mcp-server.
    export const TOOL_MAP: Record<string, MCPTool> = { [API_GET_TOOL.name]: API_GET_TOOL, [API_POST_TOOL.name]: API_POST_TOOL, [API_PUT_TOOL.name]: API_PUT_TOOL, [API_DELETE_TOOL.name]: API_DELETE_TOOL,
  • Dispatches api_post tool calls to the underlying APIClient.post handler.
    case 'api_post': return await this.apiClient.post( validatedRequest.url, validatedRequest.body, validatedRequest.headers );

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/fikri2992/mcp0'

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