Skip to main content
Glama

compare_strategies

Compare multiple strategies side-by-side by evaluating returns, drawdown, and recent performance to identify the best option.

Instructions

Compare multiple strategies side-by-side — returns, drawdown, and recent performance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productIdsYesArray of product IDs to compare, e.g. ['PROD-E3X', 'PROD-PCR']

Implementation Reference

  • The main handler function for compare_strategies. Fetches all products from the API, filters by the provided productIds array (min 2, max 8), and returns a side-by-side comparison with productId, name, market, totalReturn, maxDrawdown, recent1dReturn, and recent30dReturn.
      async ({ productIds }) => {
        const res = (await callAPI("getProducts")) as {
          code: number;
          data: Record<string, unknown>[];
        };
        if (res.code !== 0 || !Array.isArray(res.data)) {
          return {
            content: [{ type: "text" as const, text: "Failed to fetch strategies" }],
          };
        }
    
        const selected = res.data.filter((p) =>
          productIds.includes(p.productId as string)
        );
    
        if (selected.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `None of the specified product IDs were found. Use list_strategies to see available IDs.`,
              },
            ],
          };
        }
    
        const comparison = selected.map((p) => ({
          productId: p.productId,
          name: p.name,
          market: p.market || "—",
          totalReturn: p.totalReturn ?? p.totalReturn5Y ?? null,
          maxDrawdown: p.maxDrawdown ?? null,
          recent1dReturn: p.recent1dReturn ?? null,
          recent30dReturn: p.recent30dReturn ?? null,
        }));
    
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(comparison, null, 2) },
          ],
        };
      }
    );
  • Input schema definition for compare_strategies. Accepts productIds: an array of strings with at least 2 and at most 8 items, each describing a product ID like 'PROD-E3X'.
    {
      productIds: z
        .array(z.string())
        .min(2)
        .max(8)
        .describe("Array of product IDs to compare, e.g. ['PROD-E3X', 'PROD-PCR']"),
    },
  • src/index.ts:224-276 (registration)
    Registers the compare_strategies tool on the MCP server with its name, description, schema, and handler.
    server.tool(
      "compare_strategies",
      "Compare multiple strategies side-by-side — returns, drawdown, and recent performance.",
      {
        productIds: z
          .array(z.string())
          .min(2)
          .max(8)
          .describe("Array of product IDs to compare, e.g. ['PROD-E3X', 'PROD-PCR']"),
      },
      async ({ productIds }) => {
        const res = (await callAPI("getProducts")) as {
          code: number;
          data: Record<string, unknown>[];
        };
        if (res.code !== 0 || !Array.isArray(res.data)) {
          return {
            content: [{ type: "text" as const, text: "Failed to fetch strategies" }],
          };
        }
    
        const selected = res.data.filter((p) =>
          productIds.includes(p.productId as string)
        );
    
        if (selected.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `None of the specified product IDs were found. Use list_strategies to see available IDs.`,
              },
            ],
          };
        }
    
        const comparison = selected.map((p) => ({
          productId: p.productId,
          name: p.name,
          market: p.market || "—",
          totalReturn: p.totalReturn ?? p.totalReturn5Y ?? null,
          maxDrawdown: p.maxDrawdown ?? null,
          recent1dReturn: p.recent1dReturn ?? null,
          recent30dReturn: p.recent30dReturn ?? null,
        }));
    
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(comparison, null, 2) },
          ],
        };
      }
    );
  • Helper function callAPI used by compare_strategies to fetch product data from the QuantToGo API via POST to 'getProducts'.
    async function callAPI(fn: string, body: Record<string, unknown> = {}): Promise<unknown> {
      const resp = await fetch(`${API_BASE}/${fn}`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(body),
      });
      if (!resp.ok) throw new Error(`API ${fn} returned ${resp.status}`);
      return resp.json();
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It indicates a read-like operation but does not explicitly state it is safe, require authentication, or disclose side effects. The mention of returned metrics provides some insight, but behavioral traits beyond the obvious are missing.

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 sentence that is concise and densely informative, containing the verb, resource, and key comparison dimensions. No extraneous words or repetition.

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 low complexity (one parameter) and schema coverage, the description is adequate but lacks details about the output format or structure (e.g., table, percentages) which would help an agent interpret results. No differentiation from siblings or guidance on prerequisites.

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% with a clear description for productIds. The tool description ('compare multiple strategies') adds no new semantic meaning beyond the schema, which already explains the parameter. Baseline score of 3 is appropriate.

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 verb 'Compare' and resource 'strategies', specifying the aspects compared: returns, drawdown, and recent performance. It implies side-by-side comparison, distinguishing it from single-strategy tools like get_strategy_performance, though not explicitly.

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

Usage Guidelines3/5

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

The description implies usage for comparing multiple strategies, but does not provide explicit guidance on when to use this tool versus siblings like list_strategies or get_strategy_performance. No exclusion criteria or alternative tools are mentioned.

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/QuantToGo/quanttogo-mcp'

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