Skip to main content
Glama

NEAR MCP

Official

ref_finance_get_swap_estimate

Calculate accurate swap estimates on the NEAR blockchain using Ref Finance, specifying input/output tokens, amount, and pool details. Optimize token exchanges with smart routing or specific pool IDs.

Instructions

Get a swap estimate from the Ref Finance exchange contract based on two tokens and a pool id.

Input Schema

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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "amount": { "description": "The amount of the input tokens to swap", "type": [ "number", "integer" ] }, "estimateType": { "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" }, "networkId": { "default": "mainnet", "enum": [ "testnet", "mainnet" ], "type": "string" }, "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": [ "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