Skip to main content
Glama

get_index_data

Retrieve custom market momentum indices (DA-MOMENTUM or QTG-MOMENTUM) with latest values, daily changes, and historical data for quantitative trading signal analysis.

Instructions

Get QuantToGo custom market indices: DA-MOMENTUM (China A-share momentum index based on CSI300/ChiNext) or QTG-MOMENTUM (strategy-weighted momentum index). Part of QuantToGo's macro-factor quantitative signal source. Returns latest value, daily change, and historical data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexIdNoIndex ID. Omit to get summary of all indices.

Implementation Reference

  • Main handler function for get_index_data tool that executes the tool logic. It has two modes: summary mode (when indexId is omitted) calls getIndexData API with action='summary', and detail mode (when indexId is provided) calls getIndexData API with action='detail' and the specific indexId. Returns JSON data for QuantToGo custom market indices.
      async ({ indexId }) => {
        if (!indexId) {
          // Summary mode
          const res = (await callAPI("getIndexData", {
            action: "summary",
          })) as { code: number; data: Record<string, unknown>[] };
          if (res.code !== 0) {
            return {
              content: [{ type: "text" as const, text: "Failed to fetch indices" }],
            };
          }
          return {
            content: [
              { type: "text" as const, text: JSON.stringify(res.data, null, 2) },
            ],
          };
        }
    
        // Detail mode
        const res = (await callAPI("getIndexData", {
          action: "detail",
          indexId,
        })) as { code: number; data: Record<string, unknown> };
        if (res.code !== 0 || !res.data) {
          return {
            content: [
              { type: "text" as const, text: `Index '${indexId}' not found` },
            ],
          };
        }
    
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(res.data, null, 2) },
          ],
        };
      }
    );
  • Zod schema definition for get_index_data tool input validation. Defines indexId parameter as an optional enum with values 'DA-MOMENTUM' or 'QTG-MOMENTUM', with a description explaining that omitting it returns a summary of all indices.
      indexId: z
        .enum(["DA-MOMENTUM", "QTG-MOMENTUM"])
        .optional()
        .describe("Index ID. Omit to get summary of all indices."),
    },
  • src/index.ts:169-215 (registration)
    Complete tool registration for get_index_data using server.tool() method. Includes tool name, description, schema, and handler function. Registers the tool with the MCP server for QuantToGo custom market indices access.
    server.tool(
      "get_index_data",
      "Get QuantToGo custom market indices: DA-MOMENTUM (China A-share momentum index based on CSI300/ChiNext) or QTG-MOMENTUM (strategy-weighted momentum index). Part of QuantToGo's macro-factor quantitative signal source. Returns latest value, daily change, and historical data.",
      {
        indexId: z
          .enum(["DA-MOMENTUM", "QTG-MOMENTUM"])
          .optional()
          .describe("Index ID. Omit to get summary of all indices."),
      },
      async ({ indexId }) => {
        if (!indexId) {
          // Summary mode
          const res = (await callAPI("getIndexData", {
            action: "summary",
          })) as { code: number; data: Record<string, unknown>[] };
          if (res.code !== 0) {
            return {
              content: [{ type: "text" as const, text: "Failed to fetch indices" }],
            };
          }
          return {
            content: [
              { type: "text" as const, text: JSON.stringify(res.data, null, 2) },
            ],
          };
        }
    
        // Detail mode
        const res = (await callAPI("getIndexData", {
          action: "detail",
          indexId,
        })) as { code: number; data: Record<string, unknown> };
        if (res.code !== 0 || !res.data) {
          return {
            content: [
              { type: "text" as const, text: `Index '${indexId}' not found` },
            ],
          };
        }
    
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(res.data, null, 2) },
          ],
        };
      }
    );
  • JavaScript implementation of get_index_data handler for Streamable HTTP transport (Seattle/International version). Contains the same logic as the TypeScript version but in JavaScript format.
      async ({ indexId }) => {
        if (!indexId) {
          const res = await callAPI("getIndexData", { action: "summary" });
          if (res.code !== 0) return { content: [{ type: "text", text: "Failed to fetch indices" }] };
          return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
        }
        const res = await callAPI("getIndexData", { action: "detail", indexId });
        if (res.code !== 0 || !res.data) return { content: [{ type: "text", text: `Index '${indexId}' not found` }] };
        return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
      }
    );
  • JavaScript implementation of get_index_data handler for SSE transport (Coze integration version). Contains the same logic as the TypeScript version but uses CommonJS require syntax.
      async ({ indexId }) => {
        if (!indexId) {
          const res = await callAPI("getIndexData", { action: "summary" });
          if (res.code !== 0) return { content: [{ type: "text", text: "Failed to fetch indices" }] };
          return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
        }
        const res = await callAPI("getIndexData", { action: "detail", indexId });
        if (res.code !== 0 || !res.data) return { content: [{ type: "text", text: `Index '${indexId}' not found` }] };
        return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
      }
    );

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