Skip to main content
Glama

make_http_request

Execute HTTP requests (GET, POST, PUT, DELETE) with custom headers and body using curl, enabling integration with Puppeteer MCP Server for web automation tasks.

Instructions

Make an HTTP request with curl

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesBody to include in the request
headersYesHeaders to include in the request
typeYesType of the request. GET, POST, PUT, DELETE
urlYesUrl to make the request to

Implementation Reference

  • The switch case handler for the 'make_http_request' tool, which delegates to the makeRequest utility function.
    case "make_http_request": { const response = await makeRequest( args.url, args.type, args.headers, args.body ); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], isError: false, }; }
  • Input schema definition for the make_http_request tool, defining parameters like type, url, headers, body.
    { name: "make_http_request", description: "Make an HTTP request with curl", inputSchema: { type: "object", properties: { type: { type: "string", description: "Type of the request. GET, POST, PUT, DELETE", }, url: { type: "string", description: "Url to make the request to", }, headers: { type: "object", description: "Headers to include in the request", }, body: { type: "object", description: "Body to include in the request", }, }, required: ["type", "url", "headers", "body"], }, },
  • index.ts:278-280 (registration)
    Registration of the tools list (TOOLS array including make_http_request) for ListToolsRequestSchema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
  • The makeRequest helper function that implements the core HTTP request logic using fetch.
    export async function makeRequest( url: string, type: string, headers: Record<string, string>, body: any ) { try { const response = await fetch(url, { method: type, headers, body: body && (type === "POST" || type === "PUT") ? JSON.stringify(body) : undefined, }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return { status: response.status, data: await response.text(), headers: Object.fromEntries(response.headers), }; } catch (error) { console.error("Error making request:", error); throw error; } }

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/jwaldor/mcp-scrape-copilot'

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