Skip to main content
Glama

Send Airtime

airtime_send
Destructive

Send airtime top-up to any MTN, Safaricom, Airtel, or Vodafone subscriber. Common use cases include NGO field incentives, survey rewards, and agent payouts. Sandbox mode returns no real airtime for testing.

Instructions

Send airtime top-up to any MTN/Safaricom/Airtel/Vodafone subscriber. Common use: NGO field incentives, survey rewards, agent payouts. No real airtime sent in sandbox mode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phoneYesRecipient phone in E.164 format e.g. '+254712345678'
amountYesAmount as string e.g. '50' (KES 50). Minimum KES 10 in production.
currency_codeNoISO currency code: KES, NGN, GHS, UGX, TZS, RWF, ZARKES

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The airtime_send handler function that sends airtime top-up via Africa's Talking API. Takes phone, amount, and currency_code, calls the AT Airtime API, and returns success/status/amount/request_id/error.
    def airtime_send(
        phone: Annotated[str, "Recipient phone in E.164 format e.g. '+254712345678'"],
        amount: Annotated[str, "Amount as string e.g. '50' (KES 50). Minimum KES 10 in production."],
        currency_code: Annotated[str, "ISO currency code: KES, NGN, GHS, UGX, TZS, RWF, ZAR"] = "KES",
    ) -> dict:
        """
        Send airtime top-up to any MTN/Safaricom/Airtel/Vodafone subscriber.
        Common use: NGO field incentives, survey rewards, agent payouts.
        No real airtime sent in sandbox mode.
        """
        at = _at_airtime()
        response = at.send(phone_number=phone, amount=amount, currency_code=currency_code)
        recipients = response.get("responses", [])
    
        if recipients:
            r = recipients[0]
            return {
                "success":    r.get("status") == "Success",
                "status":     r.get("status"),
                "amount":     r.get("amount"),
                "request_id": r.get("requestId"),
                "error":      r.get("errorMessage") if r.get("status") != "Success" else None,
            }
    
        return {"success": False, "error": "No response from API", "raw": response}
  • The @mcp.tool annotation registering airtime_send as an MCP tool with title 'Send Airtime' and metadata annotations.
    @mcp.tool(annotations={
        'title': 'Send Airtime',
        'readOnlyHint': False,
        'destructiveHint': True,
        'idempotentHint': False,
        'openWorldHint': True,
    })
  • Helper function _at_airtime() that initializes Africa's Talking SDK and returns the Airtime service instance.
    def _at_airtime():
        africastalking.initialize(
            username=os.environ["AT_USERNAME"],
            api_key=os.environ["AT_API_KEY"],
        )
        return africastalking.Airtime
  • Input schema for airtime_send: phone (E.164 string), amount (string), currency_code (string, defaults to 'KES'). Return type is dict.
    def airtime_send(
        phone: Annotated[str, "Recipient phone in E.164 format e.g. '+254712345678'"],
        amount: Annotated[str, "Amount as string e.g. '50' (KES 50). Minimum KES 10 in production."],
        currency_code: Annotated[str, "ISO currency code: KES, NGN, GHS, UGX, TZS, RWF, ZAR"] = "KES",
    ) -> dict:
Behavior4/5

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

Annotations already note destructiveHint=true and readOnlyHint=false. The description adds useful behavioral context: no real airtime sent in sandbox mode. Does not cover rate limits, idempotency, or error behavior, but given annotations, it's adequate.

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?

Extremely concise: two sentences plus a sandbox note. Every sentence adds value and the most critical information is front-loaded.

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

Completeness5/5

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

For a simple tool with a known output schema (implied), the description covers purpose, supported networks, common use cases, and sandbox behavior. No gaps identified.

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?

Schema coverage is 100% with clear descriptions for all three parameters. Description adds no new parameter information beyond schema, so baseline 3 is appropriate.

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?

Clearly states the tool sends airtime top-up to specific mobile networks (MTN/Safaricom/Airtel/Vodafone). Distinguishes itself from sibling tools like mpesa_stk_push and sms_send by focusing on airtime transfer.

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 common use cases (NGO incentives, survey rewards, agent payouts) and a sandbox behavior note. Lacks explicit 'when not to use' or comparisons to alternative tools, but context is sufficient for appropriate invocation.

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/gabrielmahia/mpesa-mcp'

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