Skip to main content
Glama
Pavilion-devs

Saros MCP Server

get_lp_positions

Retrieve all liquidity pool positions for a Solana wallet address, including pool details, token balances, and LP token amounts.

Instructions

Get all liquidity pool positions for a wallet address. Returns pool details, token balances, and LP token amounts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletYesSolana wallet address (base58 encoded)

Implementation Reference

  • Main execution logic for the get_lp_positions tool. Validates input, fetches positions from poolService, formats response with position details.
    async function getLpPositionsTool(args, poolService) {
      const { wallet } = args;
    
      if (!wallet) {
        throw new Error("Wallet address is required");
      }
    
      try {
        const positions = await poolService.getLPPositions(wallet);
    
        if (positions.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No LP positions found for wallet: ${wallet}`,
              },
            ],
          };
        }
    
        // Format positions for display
        const positionsText = positions
          .map(
            (pos, idx) =>
              `\n**Position ${idx + 1}:**\n` +
              `- Pool: ${pos.poolAddress}\n` +
              `- LP Balance: ${pos.lpTokenBalance}\n` +
              `- Token 0: ${pos.token0}\n` +
              `- Token 1: ${pos.token1}\n`
          )
          .join("\n");
    
        return {
          content: [
            {
              type: "text",
              text:
                `Found ${positions.length} LP position(s) for wallet: ${wallet}\n` +
                positionsText +
                `\n\n**Summary:**\n` +
                `Total Positions: ${positions.length}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to get LP positions: ${error.message}`);
      }
    }
  • Input schema and description for the get_lp_positions tool, defined in the ListTools response.
      name: "get_lp_positions",
      description:
        "Get all liquidity pool positions for a wallet address. Returns pool details, token balances, and LP token amounts.",
      inputSchema: {
        type: "object",
        properties: {
          wallet: {
            type: "string",
            description: "Solana wallet address (base58 encoded)",
          },
        },
        required: ["wallet"],
      },
    },
  • src/index.js:156-157 (registration)
    Tool dispatch/registration in the CallToolRequestSchema handler switch statement.
    case "get_lp_positions":
      return await getLpPositionsTool(args, this.poolService);
  • Supporting method in SarosPoolService that retrieves LP token accounts for a wallet and constructs position objects.
    async getLPPositions(walletAddress) {
      try {
        const wallet = new PublicKey(walletAddress);
        const tokenAccounts = await this.connection.getParsedTokenAccountsByOwner(
          wallet,
          { programId: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA") }
        );
    
        const positions = [];
        for (const account of tokenAccounts.value) {
          const accountInfo = account.account.data.parsed.info;
          const balance = accountInfo.tokenAmount.uiAmount;
          if (balance > 0 && positions.length < 5) {
            positions.push({
              poolAddress: accountInfo.mint,
              lpTokenBalance: balance,
              lpTokenMint: accountInfo.mint,
              token0: "TokenA",
              token1: "TokenB",
            });
          }
        }
        return positions;
      } catch (error) {
        throw new Error(`Failed to get LP positions: ${error.message}`);
      }
    }
  • src/index.js:16-16 (registration)
    Import of the tool handler function.
    const { getLpPositionsTool } = require("./tools/get-lp-positions.js");
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool retrieves data ('Get all...') but lacks details on permissions, rate limits, error handling, or whether it's a read-only operation. The description implies it's a query but doesn't explicitly confirm safety or constraints.

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

Conciseness5/5

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

The description is two concise sentences with zero waste: the first states the purpose and input, the second specifies the return data. It's front-loaded with the core functionality and efficiently structured without unnecessary 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 (single parameter, no output schema, no annotations), the description is adequate but has gaps. It covers the purpose and return values but lacks usage context, behavioral details, and output structure, making it minimally viable but incomplete for optimal agent understanding.

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?

Schema description coverage is 100%, so the schema already documents the single parameter 'wallet' as a Solana address. The description adds no additional parameter semantics beyond what's in the schema, such as format examples or validation rules, meeting the baseline for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('Get all liquidity pool positions') and resource ('for a wallet address'), with explicit mention of what data is returned ('pool details, token balances, and LP token amounts'). It distinguishes from siblings like 'get_farm_positions' by focusing on liquidity pools rather than farms.

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?

The description provides no guidance on when to use this tool versus alternatives like 'portfolio_analytics' or 'simulate_rebalance'. It mentions what the tool does but offers no context about appropriate scenarios, prerequisites, or exclusions for usage.

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