Skip to main content
Glama
carlosahumada89

govrider-mcp-server

check_credits

Verify your GovRider credit balance to determine how many enriched searches you can execute. Each enriched search consumes 1 credit; discovery searches and opportunity details are free.

Instructions

Check your GovRider credit balance. Each enriched search costs 1 credit. Discovery search and opportunity details are free.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:302-338 (registration)
    Registration of the 'check_credits' tool with the MCP server, including its input schema (empty) and handler function.
    server.registerTool(
      'check_credits',
      {
        description:
          'Check your GovRider credit balance. Each enriched search costs 1 credit. Discovery search and opportunity details are free.',
        inputSchema: {},
      },
      async () => {
        const { ok, status, data } = await apiCall('/api/v1/credits', undefined, 'GET')
    
        if (!ok) {
          return {
            content: [{ type: 'text' as const, text: errorText(data, status) }],
            isError: true,
          }
        }
    
        const credits = data.credits as number
        const totalScanned = data.total_scanned as number
    
        return {
          content: [{
            type: 'text' as const,
            text: [
              `Credits remaining: ${credits}`,
              `Database: ${totalScanned?.toLocaleString() ?? '?'} active opportunities indexed`,
              '',
              'Pricing:',
              '- search_opportunities: FREE (sector + metadata only)',
              '- search_enriched: 1 credit (compact ranked summary of 10 matches)',
              '- get_opportunity: FREE (full details for any match from last search)',
              '- Buy credits: https://govrider.ai/pricing',
            ].join('\n'),
          }],
        }
      },
    )
  • Handler function for check_credits: calls GET /api/v1/credits via apiCall, returns remaining credits and total scanned opportunities, along with pricing info.
    async () => {
      const { ok, status, data } = await apiCall('/api/v1/credits', undefined, 'GET')
    
      if (!ok) {
        return {
          content: [{ type: 'text' as const, text: errorText(data, status) }],
          isError: true,
        }
      }
    
      const credits = data.credits as number
      const totalScanned = data.total_scanned as number
    
      return {
        content: [{
          type: 'text' as const,
          text: [
            `Credits remaining: ${credits}`,
            `Database: ${totalScanned?.toLocaleString() ?? '?'} active opportunities indexed`,
            '',
            'Pricing:',
            '- search_opportunities: FREE (sector + metadata only)',
            '- search_enriched: 1 credit (compact ranked summary of 10 matches)',
            '- get_opportunity: FREE (full details for any match from last search)',
            '- Buy credits: https://govrider.ai/pricing',
          ].join('\n'),
        }],
      }
    },
  • Input schema for check_credits — empty object since no parameters are needed.
    {
      description:
        'Check your GovRider credit balance. Each enriched search costs 1 credit. Discovery search and opportunity details are free.',
      inputSchema: {},
  • apiCall helper used by the check_credits handler to make the GET request to /api/v1/credits.
    async function apiCall(
      path: string,
      body?: Record<string, unknown>,
      method: 'GET' | 'POST' = 'POST',
    ): Promise<{
      ok: boolean
      status: number
      data: Record<string, unknown>
    }> {
      const res = await fetch(`${API_BASE}${path}`, {
        method,
        headers: {
          'Authorization': `Bearer ${API_KEY}`,
          'Content-Type': 'application/json',
        },
        ...(body ? { body: JSON.stringify(body) } : {}),
      })
    
      let data: Record<string, unknown>
      try {
        data = (await res.json()) as Record<string, unknown>
      } catch {
        data = { error: 'invalid_response', message: `Server returned ${res.status} with non-JSON body` }
      }
    
      return { ok: res.ok, status: res.status, data }
    }
  • errorText helper used by check_credits to format error messages for different HTTP status codes (401, 402, 429).
    function errorText(data: Record<string, unknown>, status: number): string {
      const msg = (data.message as string) ?? 'Unknown error'
      if (status === 401) return `Authentication failed: ${msg}. Check your GOVRIDER_API_KEY.`
      if (status === 402) return `No credits remaining. Purchase more at https://govrider.ai/pricing`
      if (status === 429) return `Rate limit exceeded. ${msg}`
      return `Error (${status}): ${msg}`
    }
Behavior3/5

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

No annotations exist, so description carries burden. Describes a read-only operation but does not disclose if authentication is needed, real-time nature, or potential side effects. Adequate but incomplete.

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?

Two concise sentences, front-loaded with the core action being 'check your credit balance'. Every sentence adds value; no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool is simple with no parameters, but lacks output description. Given no output schema, description could mention what the balance return looks like (e.g., integer, message). Somewhat incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist (100% schema coverage), so baseline is 4. Description adds no parameter info, which is appropriate as there are none.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the purpose as checking credit balance, with specific verb 'check' and resource 'credit balance'. It distinguishes from sibling tools which are search/get operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context about when credits are used (enriched searches) and that other actions are free, implying the tool should be used to check balance before enriched searches. Lacks explicit when-not-to-use but context is strong.

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

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/carlosahumada89/govrider-mcp-server'

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