Skip to main content
This page lists every tool the AgentPay MCP (Model Context Protocol) server provides, with its arguments and an example response. For the order in which your agent calls them, see the AgentPay MCP integration guide.

Tools at a glance

AgentPay provides 17 tools, grouped by the step of the payment flow they belong to. Tools that work with the customer’s wallet need the access_token from the consent step: Cashfree may add response fields over time, so read the fields you need and ignore the rest. For the format of a failed result, see Technical details.

Find the biller

These tools identify the biller and the details the customer must give.

list_biller_categories

Lists all bill categories. Use it to map what the customer says, such as “my electricity bill”, to a category name. Categories rarely change, so you can cache this list. Arguments: None. Call it with {}.
Response

list_billers

Finds billers in one or more categories and tells you what each one needs.
Response
The key fields to read are:
  • biller_id: pass it to the fetch, debit and payment tools.
  • biller_customer_params: the details to ask the customer for. Use each param_name exactly as written, and check values against regex.
  • fetch_requirement and support_bill_validation: decide whether to fetch, validate or pay directly (see Choose a payment flow).
  • payment_amount_exactness: whether the customer must pay the exact bill amount, or can pay more or less.
  • status: prefer billers that are ACTIVE.
  • truncated and note: present when more billers matched than limit. Narrow the search or raise limit.

Fetch the bill

These tools fetch the amount due, or validate the customer’s details for a validate-first biller.

request_bill_fetch

Starts fetching a customer’s bill and returns a ref_id. The bill arrives a moment later through poll_bill_fetch. For a validate-first biller, it validates the customer’s details instead. Don’t use it for direct-payment billers.
Response
Save the ref_id. You use it to poll the bill, debit the wallet (as reference_id) and pay the biller (as bill_fetch_ref_id). flow is FETCH_AND_PAY for a normal bill or VALIDATE_AND_PAY when Cashfree only validates the customer’s details. A ref_id is valid for 15 minutes. If it’s older when you’re ready to debit the wallet, call request_bill_fetch again. If it expires after wallet_pay but before the bill payment reaches the biller, refund the debit once it’s 15 minutes old, then start again with a fresh fetch.

poll_bill_fetch

Checks whether the bill has arrived. Call it every 2 to 3 seconds.
Response
response_code is PENDING while the bill is on its way, 000 on success, or another code if the fetch failed. Show the customer the name, amount and due date from biller_response. Amounts are strings in rupees, and dates use YYYY-MM-DD. For a validate-first biller, a 000 response has bill_fetch_response and additional_info but no biller_response or bill_details. That means the customer’s details are valid, but there’s no bill amount, so ask the customer how much to pay. You don’t need to copy anything from this response into later calls. request_bill_payment reads the bill back from Cashfree using the ref_id. These tools get the customer’s one-time approval and manage their tokens.

create_mandate_session

Creates the consent link. The customer opens it, logs in with a one-time password (OTP), approves your agent, and can top up their wallet.
Response
Send the customer the consent_link in plain words, for example: “To pay from your wallet, open this link, log in with the OTP and approve.”

get_mandate_session

Checks whether the customer has finished on the consent page. While the customer is still on the page, the response is { "status": "PENDING" }. Once they approve, it looks like this:
Response
expires_in is the number of seconds until the access_token expires. max_amount_per_month is in rupees. If the status is EXPIRED or FAILED, stop polling and create a new session.

refresh_access_token

Gets a new access_token when the old one expires.
Response
This fails once the customer’s consent has expired or been revoked. In that case, create a new consent session. Ends the customer’s consent when they ask your agent to stop paying from their wallet. Every access_token and refresh_token for that consent stops working. Payments already in progress still complete, and refunds remain possible.
Response
You can call it again safely. A revoked consent returns REVOKED with the same revoked_at. A consent that had already expired or been declined returns its current status with no revoked_at. To pay for this customer again, create a new consent session.

Check the wallet balance

These tools check the wallet balance and add money when it’s short.

get_wallet_balance

Checks whether the wallet can pay the bill.
Response
balance is in rupees, so 1500 means ₹1,500. If eligibility is false, blocked is true or wallet_exists is false, read reason to see why.

topup_wallet

Creates a payment link so the customer can add money to their wallet.
Response
Send the customer the payment_link, then check get_topup_status.

get_topup_status

Checks whether the customer has paid the top-up. The response looks like the topup_wallet response. order_status is ACTIVE until the customer pays, then PAID. Check get_wallet_balance before you debit.

Debit the wallet

These tools take money from the wallet and confirm the debit.

wallet_pay

Takes money from the customer’s wallet for a bill. This only debits the wallet. It doesn’t pay the biller.
Response
For a direct payment, the response has biller_id instead of reference_id. ACCEPTED means the request was received, not that the money moved. Always call get_pay_status next. Cashfree refuses the debit in the following cases: Cashfree also refuses the debit if the category is Credit Card or Loan Repayment, or if the balance is too low.

get_pay_status

Confirms the debit and gives you the transaction_id you need to pay the biller.
Response
txstatus is SUCCESS when the wallet was debited. INITIATED or PENDING means check again. FAILED means no money moved, so don’t pay the biller.

Pay the biller

These tools tell the biller the bill is paid and return the receipt.

request_bill_payment

Tells the biller the bill is paid, using the wallet debit as proof. The result arrives through poll_bill_payment. The server adds the payment mode (Wallet) and the BBPS agent and device details itself. What you send depends on the payment flow:
  • Fetched bill: send bill_fetch_ref_id. The server reads the customer details, bill and amount back from the fetch, so they always match what the biller sent.
  • Validated bill: send bill_fetch_ref_id, customer_params and amount, because a validation has no bill to read back.
  • Direct payment: leave out bill_fetch_ref_id, and send customer_params and amount.
Response
Save the transaction_ref_id and pass it to poll_bill_payment.

poll_bill_payment

Checks the final result of the bill payment. Call it until the status is SUCCESS or FAILURE.
Response
Give the customer the utr as their receipt. On FAILURE, the response also includes error_code and error_message.

Refund

These tools return money to the customer’s wallet. They find the debit by your order_id, so they work even after the customer’s consent expires or is revoked.

refund_payment

Returns a wallet debit to the customer. You can refund a debit whose txstatus is SUCCESS when its bill payment failed, or when the bill payment never reached the biller and the debit is at least 15 minutes old.
Response
Cashfree refuses the refund with bill_already_paid if the biller received the payment, or bill_payment_not_terminal while the bill payment is still in progress.

get_refund_status

Checks whether the refund has completed. The response looks like the refund_payment response. refund_status changes from PENDING to SUCCESS when the money is back in the wallet.

Technical details

Most integrations don’t need this section. It’s here for when you’re debugging or building a custom MCP client.

Server endpoints and protocol

The server uses the MCP Streamable HTTP transport and is stateless: The Cashfree API version is 2025-01-01, set by the server. Each Cashfree call times out after 30 seconds. The server also exposes a flow guide that agents can read for context, at docs://agent-pay-bbps-flow (text/markdown):
Request

Tool result format

A successful tool result contains the Cashfree response as JSON text. Parse content[0].text as JSON:
Successful result
A failed result has isError: true and a message with the HTTP status, method, path and Cashfree’s error:
Failed result
The server converts any integer with 16 or more digits to a string, so long IDs such as transaction_id are never rounded.

Error types

Errors come from the following places:

Headers the server sends to Cashfree

The server forwards your API key and the tool arguments to Cashfree as the following headers. For how your API key is handled, see Security. The server also adds the Bharat Bill Payment System (BBPS) agent ID, initiating channel, IP and MAC to every bill fetch and bill payment. Your agent never sends these values.

Instructions the server gives your agent

When your agent connects, the server returns instructions for the model. In short, they tell the model to:
  • Never ask the customer for tokens, sessions or mandates.
  • Reuse an access_token from earlier in the conversation, or start a consent session straight away.
  • Talk to the customer only about the bill, amount, due date and payment result, never about API keys, IDs, tokens or API calls.
  • On failure, say the bill couldn’t be fetched or paid, and offer to try again.