Skip to main content
Glama

get_payment_channels

Retrieve available Malaysian payment channels for processing transactions through the Bayarcash payment gateway API.

Instructions

Get list of available payment channels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portal_keyNoOptional portal key to filter channels

Implementation Reference

  • 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'
          }
        }
      }
    },
  • 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()
    });
  • 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' }
      ];
    }

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/khairulimran-97/bayarcash-mcp-server'

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