Skip to main content
Glama
Pavilion-devs

Saros MCP Server

get_farm_positions

Retrieve farming positions and staking rewards for a Solana wallet, 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

  • Primary handler function that executes the get_farm_positions tool logic: validates wallet input, fetches positions from farmService, formats output as formatted text response, handles empty results and errors.
    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}`);
      }
    }
  • Schema definition for the get_farm_positions tool, including input schema (wallet address required), provided in the ListTools response for tool discovery.
      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 registration in the central CallToolRequestSchema handler: dispatches calls to get_farm_positions to the specific getFarmPositionsTool function with farmService.
    case "get_farm_positions":
      return await getFarmPositionsTool(args, this.farmService);
  • src/index.js:19-19 (registration)
    Import of the getFarmPositionsTool handler from its dedicated tool module.
    const { getFarmPositionsTool } = require("./tools/get-farm-positions.js");
  • Supporting service method called by the tool handler to retrieve farm positions data (currently a stub implementation).
    async getFarmPositions(walletAddress) {
      // Return empty for demo
      return [];
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions what data is retrieved (farming positions, staked LP tokens, claimable rewards) but lacks critical details such as whether this is a read-only operation, potential rate limits, authentication requirements, or error handling for invalid wallets.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that directly state the tool's function and outputs. It's front-loaded with the main purpose, though it could be slightly more structured by separating scope details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (retrieving multiple data types for a wallet), no annotations, and no output schema, the description is minimally adequate. It specifies what data is returned but lacks details on format, pagination, or error cases, leaving gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'wallet' parameter clearly documented as a 'Solana wallet address'. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get all farming positions and staking rewards for a wallet' specifies the verb (get) and resource (farming positions and staking rewards). It distinguishes from sibling tools like 'get_lp_positions' by including staking rewards, but doesn't explicitly contrast with 'portfolio_analytics' or 'simulate_rebalance'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention sibling tools like 'get_lp_positions' (which might focus only on LP tokens) or 'portfolio_analytics' (which could offer broader analysis), leaving the agent without explicit usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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