Skip to main content
Glama

get_farm_positions

Retrieve farming positions and staking rewards for any Solana wallet address, including staked LP tokens and claimable rewards.

Instructions

Get all farming positions and staking rewards for a wallet. Shows staked LP tokens and claimable rewards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletYesSolana wallet address

Implementation Reference

  • Main tool execution handler: validates wallet arg, fetches positions via farmService, formats detailed text response with positions and rewards.
    async function getFarmPositionsTool(args, farmService) { const { wallet } = args; if (!wallet) { throw new Error("Wallet address is required"); } try { const positions = await farmService.getFarmPositions(wallet); if (positions.length === 0) { return { content: [ { type: "text", text: `No farm positions found for wallet: ${wallet}`, }, ], }; } // Format positions let positionsText = `**Farm Positions for ${wallet}**\n\n`; positionsText += `Total Farms: ${positions.length}\n\n`; positions.forEach((pos, idx) => { positionsText += `**Position ${idx + 1}:**\n` + `- Farm: ${pos.farmAddress}\n` + `- LP Token: ${pos.lpAddress}\n` + `- Staked Amount: ${pos.stakedAmount}\n` + `- Pool: ${pos.token0} / ${pos.token1}\n`; if (pos.pendingRewards && pos.pendingRewards.length > 0) { positionsText += `- Pending Rewards:\n`; pos.pendingRewards.forEach((reward) => { positionsText += ` • ${reward.amount} ${reward.symbol}\n`; }); } positionsText += `\n`; }); return { content: [ { type: "text", text: positionsText, }, ], }; } catch (error) { throw new Error(`Failed to get farm positions: ${error.message}`); } }
  • Input schema definition for the get_farm_positions tool, specifying required 'wallet' string parameter.
    { name: "get_farm_positions", description: "Get all farming positions and staking rewards for a wallet. Shows staked LP tokens and claimable rewards.", inputSchema: { type: "object", properties: { wallet: { type: "string", description: "Solana wallet address", }, }, required: ["wallet"], }, },
  • src/index.js:165-166 (registration)
    Tool dispatch/registration in the CallToolRequestSchema switch statement, invoking the handler with args and farmService.
    case "get_farm_positions": return await getFarmPositionsTool(args, this.farmService);
  • src/index.js:19-19 (registration)
    Import of the getFarmPositionsTool handler from its module.
    const { getFarmPositionsTool } = require("./tools/get-farm-positions.js");
  • Helper service method called by the tool handler to fetch farm positions (demo implementation returns empty array).
    async getFarmPositions(walletAddress) { // Return empty for demo return []; }

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/Pavilion-devs/saros-mcp-server'

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