Skip to main content
Glama
nasoma

Africa's Talking Airtime MCP

check_balance

Retrieve your current airtime account balance from Africa's Talking to monitor available funds for transactions across supported African countries.

Instructions

Checks the airtime balance of the Africa's Talking account.

This tool connects to the Africa's Talking API to fetch the user's
current application data, which includes the account balance.

Returns:
    str: A message displaying the account balance or an error if the
         balance cannot be retrieved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:122-140 (handler)
    The 'check_balance' tool handler. This async function is decorated with @mcp.tool(), making it the primary implementation. It queries the Africa's Talking API for the account balance and returns a formatted string.
    async def check_balance() -> str:
        """Checks the airtime balance of the Africa's Talking account.
    
        This tool connects to the Africa's Talking API to fetch the user's
        current application data, which includes the account balance.
    
        Returns:
            str: A message displaying the account balance or an error if the
                 balance cannot be retrieved.
        """
        try:
            response = africastalking.Application.fetch_application_data()
            if "UserData" in response and "balance" in response["UserData"]:
                balance = response["UserData"]["balance"]
                return f"Account Balance: {balance}"
            else:
                return "Balance information not available at the moment. Try again later."
        except Exception as e:
            return f"Error fetching balance: {str(e)}"
Behavior4/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 effectively describes the tool's behavior: connecting to an external API, fetching application data, and returning either a balance message or an error. It covers the core operation and error handling, though it lacks details like rate limits, authentication requirements, or specific error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose. The second sentence adds necessary detail about the API connection, and the 'Returns' section clarifies output behavior. It's efficient with minimal waste, though the 'Returns' formatting could be slightly more concise.

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

Completeness4/5

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

Given the tool's low complexity (0 parameters, no output schema, no annotations), the description is reasonably complete. It explains what the tool does, how it operates via API, and what it returns. For a simple balance check tool, this covers essential context, though it could benefit from more detail on error scenarios or API specifics.

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?

The input schema has 0 parameters with 100% coverage, so the schema fully documents the lack of inputs. The description adds value by confirming no parameters are needed ('checks the airtime balance' implies a simple query without inputs), aligning with the schema. Baseline is 4 for 0 parameters, as it provides clear semantic context.

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 specific action ('Checks') and resource ('airtime balance of the Africa's Talking account'), distinguishing it from sibling tools that focus on top-up operations rather than balance inquiry. It precisely defines what the tool does without ambiguity.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning it fetches 'application data' and 'account balance', suggesting it's for checking current balance status. However, it doesn't explicitly state when to use this tool versus alternatives like checking transaction history through sibling tools, nor does it provide exclusion criteria or prerequisites.

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/nasoma/africastalking-airtime-mcp'

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