Skip to main content
Glama

usage

Check your SearchClaw API credit balance to monitor usage and manage costs for web search, extraction, and crawling operations.

Instructions

Check your SearchClaw API credit balance. Costs 0 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:224-229 (registration)
    Registration of the 'usage' tool with MCP server. The tool takes no parameters and calls the /usage API endpoint to check credit balance.
    server.tool(
      "usage",
      "Check your SearchClaw API credit balance. Costs 0 credits.",
      {},
      async () => jsonResult(await apiGet("/usage"))
    );
  • Handler function that makes HTTP GET requests to the SearchClaw API. This is called by the usage tool to fetch credit balance data from /usage endpoint.
    async function apiGet(path: string, params?: Record<string, string>) {
      const url = new URL(`${API_BASE}${path}`);
      if (params) {
        for (const [key, value] of Object.entries(params)) {
          url.searchParams.set(key, value);
        }
      }
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 30000);
      try {
        const response = await fetch(url.toString(), { headers, signal: controller.signal });
        if (!response.ok) {
          const text = await response.text();
          throw new Error(`SearchClaw API error ${response.status}: ${text}`);
        }
        return response.json();
      } finally {
        clearTimeout(timeout);
      }
    }
  • Helper function that formats API response data into MCP tool result format with JSON stringification.
    function jsonResult(data: unknown) {
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }

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/CSteenkamp/searchclaw-mcp'

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