api_get
Initiate HTTP GET requests to any specified URL using the MCP API Server. Input a URL and optional headers to retrieve data from external APIs with precision and ease.
Instructions
Make an HTTP GET request to the specified URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| headers | No | Optional headers to include in the request | |
| url | Yes | The URL to make the GET request to |
Implementation Reference
- src/tools.ts:10-31 (schema)Defines the MCPTool metadata including name, description, and inputSchema for the api_get tool.export const API_GET_TOOL: MCPTool = { name: 'api_get', description: 'Make an HTTP GET request to the specified URL', inputSchema: { type: 'object', properties: { url: { type: 'string', format: 'uri', description: 'The URL to make the GET request to', }, headers: { type: 'object', description: 'Optional headers to include in the request', additionalProperties: { type: 'string', }, }, }, required: ['url'], }, };
- src/api-client.ts:64-70 (handler)The APIClient.get() method implements the core execution logic for the api_get tool, creating and sending the HTTP GET request.async get(url: string, headers?: Record<string, string>): Promise<APIResponse | ErrorResponse> { return this.makeRequest({ url, method: 'GET', headers, }); }
- src/mcp-server.ts:85-90 (registration)Registers the MCP list_tools handler which returns all available tools including api_get.this.server.setRequestHandler(ListToolsRequestSchema, async () => { this.log('Received list_tools request'); return { tools: ALL_API_TOOLS, }; });
- src/tools.ts:138-143 (registration)Creates a lookup map of tool names to MCPTool definitions, registering api_get for quick access during tool calls.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, };
- src/mcp-server.ts:200-202 (handler)Dispatches api_get tool calls to the APIClient.get() handler in the MCP server's handleToolCall method.case 'api_get': return await this.apiClient.get(validatedRequest.url, validatedRequest.headers);