Skip to main content
Glama

api_get

Performs a GET request to an API endpoint by specifying the URL and optional headers, enabling direct interaction with web services through the Browser Agent MCP.

Instructions

Perform a GET request to an API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
headersNoRequest headers
urlYesAPI endpoint URL

Implementation Reference

  • Core implementation of the 'api_get' tool: performs a GET request using Playwright APIRequestContext, handles headers, fetches response data, and formats output including status and body.
    async function handleApiGet(client: APIRequestContext, args: any): Promise<{ toolResult: CallToolResult }> {
      try {
        const options = args.headers ? { headers: args.headers } : undefined;
        const response = await client.get(args.url, options);
        const responseData = await getResponseData(response);
    
        return {
          toolResult: {
            content: [
              {
                type: "text",
                text: `GET ${args.url} - Status: ${response.status()}`,
              },
              ...responseData
            ],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `GET request failed: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
    }
  • Tool definition for 'api_get' including input schema specifying required 'url' and optional 'headers'.
    {
      name: "api_get",
      description: "Perform a GET request to an API endpoint",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string", description: "API endpoint URL" },
          headers: { 
            type: "object", 
            description: "Request headers",
            additionalProperties: { type: "string" }
          }
        },
        required: ["url"]
      }
    },
  • Registration and dispatch of 'api_get' handler in the main executeToolCall switch statement.
    case "api_get":
      return await handleApiGet(apiClient!, args);
  • Helper function used by api_get to parse and format API response body as text content, preferring pretty-printed JSON.
    async function getResponseData(response: any): Promise<TextContent[]> {
      const contentType = response.headers()['content-type'] || '';
      let responseText: string;
      if (contentType.includes('application/json')) {
        try {
          const json = await response.json();
          responseText = JSON.stringify(json, null, 2);
        } catch (e) {
          responseText = await response.text();
        }
      } else {
        responseText = await response.text();
      }
      return [{
        type: "text",
        text: `Response body:\n${responseText}`,
      } as TextContent];
    }
  • src/handlers.ts:61-63 (registration)
    MCP server handler for listing tools, which includes the 'api_get' tool from registerTools().
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: tools,
    }));
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action (GET request) but doesn't cover critical aspects like authentication needs, rate limits, error handling, or response formats. This leaves significant gaps for an agent to understand the tool's behavior.

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 that directly states the tool's function without unnecessary words. It is appropriately sized and front-loaded, 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 (API interaction with 2 parameters) and the absence of annotations and output schema, the description is incomplete. It fails to address key contextual elements like authentication, response handling, or error scenarios, which are crucial for effective use.

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?

The input schema has 100% description coverage, clearly documenting the 'url' and 'headers' parameters. The description adds no additional meaning beyond what the schema provides, such as examples or constraints, so it meets the baseline for high schema coverage without compensating value.

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 states the tool performs a GET request to an API endpoint, which is a clear verb+resource combination. However, it doesn't distinguish this from its sibling tools like api_post or api_put beyond the HTTP method, leaving the specific purpose somewhat vague in relation to alternatives.

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 like api_post or api_put. It lacks context about appropriate scenarios (e.g., retrieving data vs. modifying it) or prerequisites, offering minimal usage direction.

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/imprvhub/mcp-browser-agent'

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