Skip to main content
Glama
PaulieB14

Limitless MCP

get_trader_positions

Retrieve a trader's current positions, balances, and PnL across market types using their wallet address.

Instructions

Get a trader's current positions across both market types with balances and PnL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesTrader wallet address

Implementation Reference

  • The tool 'get_trader_positions' is registered and implemented directly in mcp-server/src/index.ts. It handles querying both 'simple' and 'negrisk' market types, hydrates condition names, and returns the positions.
    server.registerTool(
      "get_trader_positions",
      {
        description:
          "Get a trader's current positions across both market types with balances and PnL.",
        inputSchema: {
          address: z.string().describe("Trader wallet address"),
        },
      },
      async ({ address }) => {
        try {
          const addr = address.toLowerCase();
          const posQuery = `{
            userPositions(where: { user: "${addr}", balance_gt: "0" }, first: 100) {
              id tokenId balance netCostUSD realizedPnlUSD lastUpdated
              condition { id resolved payoutNumerators }
            }
          }`;
    
          const { simple, negrisk } = await queryBoth(posQuery, posQuery);
    
          const allPositions = [
            ...(simple.userPositions || []).map((p: any) => ({ ...p, marketType: "simple" })),
            ...(negrisk.userPositions || []).map((p: any) => ({ ...p, marketType: "negrisk" })),
          ];
    
          // Hydrate condition names
          const conditionIds = [
            ...new Set(allPositions.map((p: any) => p.condition?.id).filter(Boolean)),
          ];
          const names = new Map<string, string>();
          await Promise.all(
            conditionIds.map(async (id: string) => {
              names.set(id, await hydrateName(id));
            })
          );
    
          const enriched = allPositions.map((p: any) => ({
            ...p,
            marketName: names.get(p.condition?.id) || p.condition?.id || "unknown",
          }));
    
          return textResult({ address: addr, positionCount: enriched.length, positions: enriched });
        } catch (e) {
          return errorResult(e);
        }
      }
    );
Behavior3/5

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

No annotations provided, so description carries full burden. Mentions specific return data (balances, PnL) which helps, but omits details on data freshness, authentication requirements, or position status (open vs closed).

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?

Single efficient sentence (12 words) with no redundancy. Front-loaded with action ('Get...positions') and back-loaded with return details ('balances and PnL'). Slightly terse given lack of output schema.

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

Completeness4/5

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

Appropriate for low complexity (1 param, flat schema). Compensates for missing output schema by specifying return contents (balances, PnL). Could clarify what 'both market types' refers to given sibling tools don't explicitly mention market types.

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 coverage is 100% with the 'address' parameter fully documented. Description implies the parameter identifies the trader ('trader's positions') but doesn't explicitly reference the wallet address requirement or validate the parameter semantics beyond the schema.

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?

Clear verb+resource ('Get...positions') and specifies key return data ('balances and PnL'). Distinguishes from sibling get_market_positions by focusing on 'trader' scope and 'both market types', though 'Get' is slightly generic.

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 explicit when-to-use or alternative suggestions. However, 'across both market types' implicitly defines scope, distinguishing it from market-specific tools like get_market_positions.

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/PaulieB14/limitless-subgraphs'

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