get_payment_channels
Retrieve available Malaysian payment channels for processing transactions through the Bayarcash payment gateway API.
Instructions
Get list of available payment channels
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_payment_channels"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| portal_key | No | Optional portal key to filter channels |
Implementation Reference
- src/index.ts:326-342 (handler)The handler function for the 'get_payment_channels' tool. Validates the input arguments using portalKeySchema and calls bayarcash.getChannels(portal_key) to retrieve the list of payment channels.
case 'get_payment_channels': { // Validate input const validation = validateInput(portalKeySchema, args); if (!validation.success) { throw new McpError(ErrorCode.InvalidParams, `Validation error: ${validation.error}`); } const result = await bayarcash.getChannels(validation.data.portal_key); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } - src/index.ts:189-201 (registration)Registration of the 'get_payment_channels' tool in the ListTools response, including name, description, and input schema.
{ name: 'get_payment_channels', description: 'Get list of available payment channels', inputSchema: { type: 'object', properties: { portal_key: { type: 'string', description: 'Optional portal key to filter channels' } } } }, - src/validation.ts:91-93 (schema)Zod schema used for validating the input to get_payment_channels tool (portal_key optional string).
export const portalKeySchema = z.object({ portal_key: z.string().optional() }); - src/bayarcash-client.ts:232-246 (helper)The BayarcashClient method getChannels that provides the actual implementation, returning a hardcoded list of payment channels (ignores portalKey). Called by the tool handler.
async getChannels(portalKey?: string): Promise<PaymentChannel[]> { // Return hardcoded payment channels return [ { id: '1', name: 'FPX', code: 'fpx' }, { id: '2', name: 'DuitNow', code: 'duitnow' }, { id: '3', name: 'Boost', code: 'boost' }, { id: '4', name: 'GrabPay', code: 'grabpay' }, { id: '5', name: 'Touch n Go', code: 'tng' }, { id: '6', name: 'ShopeePay', code: 'shopeepay' }, { id: '7', name: 'SPayLater', code: 'spaylater' }, { id: '8', name: 'Boost PayFlex', code: 'boostpayflex' }, { id: '9', name: 'QRIS', code: 'qris' }, { id: '10', name: 'NETS', code: 'nets' } ]; }