Skip to main content
Glama

getLighthousePerformanceData

Retrieve performance metrics for a Lighthouse crypto portfolio by specifying a portfolio name and optional start date to analyze historical data securely.

Instructions

Get performance data for a Lighthouse portfolio

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portfolioNoOptional portfolio name
startDateNoOptional start date. Formatted as YYYY-MM-DD

Implementation Reference

  • Handler function that executes the tool logic: resolves the portfolio slug, determines start date (default 30 days ago), fetches performance data via lighthouse client, and constructs a formatted markdown text response with timeframe, period return, asset type changes, top gainers, and top losers.
    execute: async (args) => {
      const portfolio = args.portfolio
        ? await lighthouse.findPortfolio(args.portfolio)
        : await lighthouse.findPortfolio();
    
      const startDate = args.startDate
        ? new Date(args.startDate)
        : new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
    
      const performanceData = await lighthouse.getPerformanceData(
        portfolio.slug,
        startDate.toISOString().split("T")[0]
      );
    
      return {
        content: [
          {
            type: "text",
            text: `# ${portfolio.name} Performance Data
            Timeframe: ${performanceData.startsAt} - ${performanceData.endsAt}
            Period Return: ${formatNumber(
              performanceData.usdValueChange
            )} (${formatPercentage(
              (performanceData.usdValueChange /
                performanceData.lastSnapshotUsdValue) *
                100
            )})
            ----
            Performance by asset type:
            ${performanceData.changeByType
              .sort((a, b) => b.diffUsdValue - a.diffUsdValue)
              .map((asset) => {
                return `- ${asset.type}: ${formatNumber(
                  asset.diffUsdValue
                )} (${formatPercentage(
                  asset.prevUsdValue / asset.currUsdValue
                )}%)`;
              })
              .join("\n")}
            ----
            Top 5 Gainers:
            ${performanceData.gainers
              .sort((a, b) => b.diffUsdValue - a.diffUsdValue)
              .slice(0, 5)
              .map((gainer) => {
                return `- ${gainer.symbol}: ${formatNumber(
                  gainer.diffUsdValue
                )} (${formatPercentage(
                  gainer.diffUsdValue / gainer.prevUsdValue
                )}%)`;
              })
              .join("\n")}
            ----
            Top 5 Losers:
            ${performanceData.losers
              .sort((a, b) => a.diffUsdValue - b.diffUsdValue)
              .slice(0, 5)
              .map((loser) => {
                return `- ${loser.symbol}: ${formatNumber(
                  loser.diffUsdValue
                )} (${formatPercentage(
                  loser.diffUsdValue / loser.prevUsdValue
                )}%)`;
              })
              .join("\n")}
            `,
          },
        ],
      };
    },
  • Zod schema for validating the tool's input parameters: optional portfolio name and optional start date (YYYY-MM-DD format).
    parameters: z.object({
      portfolio: z.string().optional().describe("Optional portfolio name"),
      startDate: z
        .string()
        .optional()
        .describe("Optional start date. Formatted as YYYY-MM-DD"),
    }),
  • index.ts:374-376 (registration)
    Registration of the getLighthousePerformanceData tool with FastMCP server, specifying name and description.
    server.addTool({
      name: "getLighthousePerformanceData",
      description: "Get performance data for a Lighthouse portfolio",
  • Helper method in the Lighthouse class that performs the actual API call to retrieve performance data for a given portfolio slug and start date from the Lighthouse API.
    public async getPerformanceData(
      portfolioSlug: string,
      startDate: string
    ): Promise<PortfolioPerformanceResponse> {
      const response = await this.fetcher(
        `https://lighthouse.one/v1/workspaces/${portfolioSlug}/performance?startsAt=${startDate}`
      );
    
      if (!response.ok) {
        throw new Error(`API request failed with status ${response.status}`);
      }
    
      return await response.json();
    }
  • TypeScript interface defining the expected structure of the performance data returned from the Lighthouse API, used for type safety.
    export interface PortfolioPerformanceResponse {
      startsAt: string;
      endsAt: string;
      presets: TimeRangePresets; // Reusing TimeRangePresets
      usdValueChange: number;
      lastSnapshotUsdValue: number;
      snapshots: Snapshot[]; // Reusing Snapshot
      gainers: GainerLoserItem[]; // Reusing GainerLoserItem
      losers: GainerLoserItem[]; // Reusing GainerLoserItem
      changeByType: ChangeByTypeItem[]; // Reusing ChangeByTypeItem
    }
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 but only states the basic action. It doesn't describe whether this is a read-only operation, what the return format looks like (e.g., structured data, metrics), potential rate limits, or error conditions. This leaves significant gaps in understanding how the tool behaves beyond its simple purpose.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple data retrieval tool and front-loaded with the core action, making it easy to parse quickly.

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?

Given the lack of annotations and output schema, the description is incomplete for a data retrieval tool. It doesn't explain what 'performance data' entails (e.g., metrics, time series, aggregated results) or how results are structured, which is critical for an agent to interpret outputs. The simplicity of the tool (2 optional parameters) doesn't compensate for these missing behavioral details.

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, clearly documenting both optional parameters ('portfolio' and 'startDate') with formatting details for the date. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 where the schema does the heavy lifting without compensating for any gaps.

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 action ('Get performance data') and target resource ('for a Lighthouse portfolio'), making the purpose understandable. However, it doesn't differentiate this tool from its sibling 'getLighthouseYieldData' which suggests another type of portfolio data, leaving some ambiguity about what specifically distinguishes 'performance data' from 'yield data'.

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 'getLighthouseYieldData' or 'getLighthousePortfolio'. It doesn't mention prerequisites (e.g., whether authentication is required via the 'authenticate' sibling tool) or context for selecting this specific data retrieval method, leaving the agent to infer usage from tool names alone.

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

Related 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/l3wi/mcp-lighthouse'

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