Skip to main content
Glama
piquesignal

Pique Signal

Official

get_portfolio

Read-onlyIdempotent

Retrieve your complete paper trading portfolio summary, including balance, profit/loss, win rate, trade history, and risk configuration, from Pique Signal.

Instructions

Get full paper trading portfolio summary: balance, P&L, win rate, trade history, and risk configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/tools.js:221-245 (registration)
    Registration of the 'get_portfolio' tool in the MCP server via server.tool(), with no input schema (empty {}), metadata hints, and an async handler that delegates to traderFetch('/portfolio') or paper.getPortfolio() depending on whether a remote trader is configured.
    server.tool(
      'get_portfolio',
      'Get full paper trading portfolio summary: balance, P&L, win rate, trade history, and risk configuration.',
      {},
      {
        title: 'Get Portfolio',
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false,
      },
      async () => {
        try {
          let result;
          if (useRemoteTrader) {
            result = await traderFetch('/portfolio');
          } else {
            result = paper.getPortfolio();
          }
          return text(JSON.stringify(result, null, 2));
        } catch (err) {
          return error(err.message);
        }
      }
    );
  • Core handler that computes the full paper trading portfolio summary: balance, P&L percentages, realized profit/loss, open positions count, total exposure, completed trades, win rate, average win/loss percentages, uptime, recent trades, and risk configuration.
    getPortfolio() {
      const sells = this.#tradeLog.filter(t => t.type === 'sell');
      const wins = sells.filter(t => t.pnlSol > 0);
      const losses = sells.filter(t => t.pnlSol <= 0);
      const totalRealizedPnl = sells.reduce((s, t) => s + (t.pnlSol || 0), 0);
    
      return {
        balance: this.#round(this.#balance),
        startingBalance: this.#startingBalance,
        totalPnlPct: Math.round(((this.#balance - this.#startingBalance) / this.#startingBalance) * 10000) / 100,
        realizedPnlSol: this.#round(totalRealizedPnl),
        openPositions: this.#positions.size,
        totalExposureSol: this.#round(this.#totalExposure()),
        completedTrades: sells.length,
        winRate: sells.length ? Math.round((wins.length / sells.length) * 1000) / 10 + '%' : 'N/A',
        wins: wins.length,
        losses: losses.length,
        avgWinPct: wins.length ? Math.round(wins.reduce((s, t) => s + t.pnlPct, 0) / wins.length * 100) / 100 : 0,
        avgLossPct: losses.length ? Math.round(losses.reduce((s, t) => s + t.pnlPct, 0) / losses.length * 100) / 100 : 0,
        uptimeMin: Math.round((Date.now() - this.#startTime) / 60_000),
        recentTrades: this.#tradeLog.slice(-10),
        riskConfig: { ...this.#config },
      };
    }
  • Backend factory that creates the PaperEngine instance and traderFetch helper; used by the get_portfolio tool to decide whether to call paper.getPortfolio() or traderFetch('/portfolio').
    export function createBackend(apiKey, apiUrl) {
      const api = new PiqueSignalAPI(apiUrl, apiKey);
    
      const traderUrl = process.env.TRADER_API_URL;
      const traderKey = process.env.TRADER_API_KEY;
      const useRemoteTrader = !!(traderUrl && traderKey);
      const paper = useRemoteTrader ? null : new PaperEngine();
    
      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();
      }
    
      return { api, paper, useRemoteTrader, traderFetch };
  • src/index.js:34-34 (registration)
    Entry point where registerTools is called with the MCP server and backend, which registers get_portfolio among other tools.
    registerTools(server, backend);
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, covering safety. The description adds value by specifying the output contents, which provides additional behavioral context beyond annotations. No contradictions. Could mention freshness or caching, but adequate.

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?

Single sentence of 16 words, immediately states purpose and lists contents. No filler, perfectly front-loaded. Every word earns its place.

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?

For a simple read-only portfolio summary with no parameters and no output schema, the description covers the main output elements. It could be slightly more complete by specifying time period or data scope, but it is sufficient for typical use.

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?

Input schema has zero parameters, so no parameter documentation is needed. Schema description coverage is 100% (none). Baseline for 0 parameters is 4; description does not add parameter info but it's not required.

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?

Description clearly states it retrieves a paper trading portfolio summary, listing specific components (balance, P&L, win rate, trade history, risk configuration). It unambiguously distinguishes from sibling tools like get_positions (individual positions) and paper_buy/sell (trading actions).

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

Usage Guidelines4/5

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

The description implies the tool is for obtaining a high-level portfolio overview. While no explicit when-to-use or when-not-to-use guidance is given, the context of sibling tools makes the appropriate scenario clear. A minor gap is the lack of explicit exclusion or alternative references.

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