Skip to main content
Glama
piquesignal

Pique Signal

Official

get_positions

Get open paper positions with live prices; the system automatically executes stop-loss or take-profit sells when price thresholds are hit.

Instructions

View all open paper positions with live prices. Automatically triggers stop-loss or take-profit sells if price thresholds are hit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/tools.js:192-219 (registration)
    Registration of the 'get_positions' MCP tool with description, empty schema (no inputs), and metadata hints. Calls either traderFetch('/positions') for remote trading or paper.getPositions() for paper trading.
    server.tool(
      'get_positions',
      'View all open paper positions with live prices. Automatically triggers stop-loss or take-profit sells if price thresholds are hit.',
      {},
      {
        title: 'Get Positions',
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: false,
      },
      async () => {
        try {
          let result;
          if (useRemoteTrader) {
            result = await traderFetch('/positions');
          } else {
            result = await paper.getPositions();
          }
          if (!result.positions?.length) {
            return text('No open positions.');
          }
          return text(JSON.stringify(result, null, 2));
        } catch (err) {
          return error(err.message);
        }
      }
    );
  • Core implementation of getPositions() in the PaperEngine class. Iterates over all open positions (#positions map), fetches current prices, calculates unrealized PnL %, checks stop-loss/take-profit thresholds, automatically executes triggered sells, and returns { positions, autoSells }.
    async getPositions() {
      const results = [];
      const triggered = [];
    
      for (const [mint, pos] of this.#positions) {
        const currentPrice = await this.#fetchPrice(mint) || this.#priceCache.get(mint) || pos.entryPrice;
        this.#priceCache.set(mint, currentPrice);
    
        if (currentPrice > pos.highWaterMark) pos.highWaterMark = currentPrice;
    
        const pnlPct = ((currentPrice - pos.entryPrice) / pos.entryPrice) * 100;
    
        if (currentPrice <= pos.stopLoss) {
          triggered.push({ mint, reason: 'stop_loss', pnlPct });
        } else if (currentPrice >= pos.takeProfit) {
          triggered.push({ mint, reason: 'take_profit', pnlPct });
        }
    
        results.push({
          mint, symbol: pos.symbol,
          entrySol: pos.entrySol,
          entryPrice: pos.entryPrice,
          currentPrice,
          unrealizedPnlPct: Math.round(pnlPct * 100) / 100,
          holdTimeMin: Math.round((Date.now() - pos.entryTime) / 60_000),
          stopLoss: pos.stopLoss,
          takeProfit: pos.takeProfit,
          highWaterMark: pos.highWaterMark,
        });
      }
    
      // Auto-execute SL/TP
      const autoSells = [];
      for (const t of triggered) {
        const result = await this.sell(t.mint, t.reason);
        if (result.success) autoSells.push(result);
      }
    
      return { positions: results, autoSells };
    }
  • The traderFetch helper function used by the remote trader path of get_positions. Makes authenticated HTTP requests to the remote trader API.
    async function traderFetch(path, options = {}) {
      const url = traderUrl.replace(/\/+$/, '') + path;
      const res = await fetch(url, {
        ...options,
        headers: {
          'Content-Type': 'application/json',
          'x-webhook-secret': traderKey,
          ...(options.headers || {}),
        },
        signal: AbortSignal.timeout(TRADER_TIMEOUT_MS),
      });
      if (!res.ok) {
        const body = await res.text().catch(() => '');
        throw new Error(`Trader API ${res.status}: ${body}`);
      }
      return res.json();
    }
Behavior1/5

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

The description states it triggers stop-loss or take-profit sells, which are destructive actions, but annotations have destructiveHint: false and readOnlyHint: false (not read-only). This is a clear contradiction, misleading the agent about side effects.

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?

Two sentences, no waste. The critical behavioral detail is included upfront. Could be better structured (e.g., separating view action from trigger condition) but still efficient.

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

Completeness2/5

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

No output schema, and the description does not explain what the tool returns (e.g., list of positions with prices). The trigger condition is vague ('if price thresholds are hit'). Annotations are contradictory, reducing completeness for agent decision-making.

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

Parameters4/5

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

No parameters exist, so schema coverage is 100%. The description adds no param info but none is needed. The baseline is 4 for zero-parameter tools.

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 it views open paper positions with live prices and mentions automatic sell triggers. This distinguishes it from siblings like paper_sell and get_portfolio. However, the dual role of viewing and triggering actions could be confusing without further clarification.

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 on when to use this tool versus alternatives like paper_sell or get_portfolio. The description does not specify when automatic sell triggers occur, nor does it exclude cases where manual selling is needed.

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/piquesignal/piquesignal-mcp'

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