Skip to main content
Glama

NEAR MCP

Official

ref_finance_execute_swap

Execute token swaps on Ref Finance by selecting input and output tokens using either smart routing for optimal rates or a specific pool. Supports NEAR blockchain networks.

Instructions

Execute a swap on Ref Finance based on two tokens and a pool id. Prioritize pools with higher liquidity and better rates for the user.

Input Schema

NameRequiredDescriptionDefault
accountIdYesThe account id of the user doing the swap
amountYesThe amount of the input tokens to swap
networkIdNomainnet
swapTypeNoThe type of estimate to get. Defaults to the ref finance smart router to find the best price over all available pools
tokenInYes
tokenOutYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "accountId": { "description": "The account id of the user doing the swap", "type": "string" }, "amount": { "description": "The amount of the input tokens to swap", "type": [ "number", "integer" ] }, "networkId": { "default": "mainnet", "enum": [ "testnet", "mainnet" ], "type": "string" }, "swapType": { "anyOf": [ { "additionalProperties": false, "properties": { "pathDepth": { "default": 3, "description": "The depth of the path to search for the best pool", "type": "number" }, "slippagePercent": { "default": 0.001, "description": "The slippage to use for the estimate. Only use 0.001, 0.005, or 0.01", "type": "number" }, "type": { "const": "bySmartRoute", "description": "Get an estimate using the ref finance smart router to find the best pool", "type": "string" } }, "required": [ "type" ], "type": "object" }, { "additionalProperties": false, "properties": { "poolId": { "description": "The pool id (e.g. 1)", "type": "number" }, "type": { "const": "byPoolId", "description": "Get an estimate using a specific pool id", "type": "string" } }, "required": [ "type", "poolId" ], "type": "object" } ], "default": { "type": "bySmartRoute" }, "description": "The type of estimate to get. Defaults to the ref finance smart router to find the best price over all available pools" }, "tokenIn": { "additionalProperties": false, "properties": { "contractId": { "description": "The contract id of the input token to be swapped", "type": "string" }, "symbol": { "description": "The symbol of the input token", "type": "string" } }, "required": [ "contractId", "symbol" ], "type": "object" }, "tokenOut": { "additionalProperties": false, "properties": { "contractId": { "description": "The contract id of the output token to be swapped", "type": "string" }, "symbol": { "description": "The symbol of the output token", "type": "string" } }, "required": [ "contractId", "symbol" ], "type": "object" } }, "required": [ "accountId", "tokenIn", "tokenOut", "amount" ], "type": "object" }

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/nearai/near-mcp'

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