Skip to main content
Glama

get_spot_twap_by_user

Read-onlyIdempotent

Retrieve Hyperliquid Spot TWAP statuses for a user wallet. Returns timestamped records with coin, side, size, filled size, and execution metadata from the L4 order stream.

Instructions

Get Hyperliquid Spot TWAP statuses for a single user wallet across every spot pair. Returns timestamped TWAP status records with coin, twap_id, side, size, filled_size, status, and execution metadata. Sourced from the L4 order stream. Live from 2026-05-05.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesUser wallet address (e.g., '0x1234...')
startNoStart timestamp (Unix ms or ISO). Defaults to 24h ago.
endNoEnd timestamp (Unix ms or ISO). Defaults to now.
limitNoMax records to return (default 100, max 1000)
cursorNoPagination cursor from previous response's nextCursor

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordsYesArray of result records
countYesTotal number of records in the full result set
nextCursorNoCursor for next page, if more results available

Implementation Reference

  • Tool handler for 'get_spot_twap_by_user'. Registers the tool with address and history params, calls api().spot.twap.byUser() SDK method, and formats the cursor-paginated response.
    // Spot TWAP by User
    registerTool(
      "get_spot_twap_by_user",
      "Get Hyperliquid Spot TWAP statuses for a single user wallet across every spot pair. Returns timestamped TWAP status records with coin, twap_id, side, size, filled_size, status, and execution metadata. Sourced from the L4 order stream. Live from 2026-05-05.",
      {
        address: z.string().describe("User wallet address (e.g., '0x1234...')"),
        ...HistoryParams,
      },
      ListOutputSchema,
      async (params) => {
        const { address, start, end, limit, cursor } = params;
        const timeRange = resolveTimeRange(start, end);
        const sdkParams: Record<string, unknown> = {
          ...timeRange,
          limit: resolveLimit(limit),
        };
        if (cursor) sdkParams.cursor = cursor;
        const result = await api().spot.twap.byUser(address, sdkParams as any);
        return formatCursorResponse(result);
      }
    );
  • Input schema for get_spot_twap_by_user: requires an 'address' string, plus optional HistoryParams (start, end, limit, cursor).
    {
      address: z.string().describe("User wallet address (e.g., '0x1234...')"),
      ...HistoryParams,
    },
    ListOutputSchema,
  • src/index.ts:1448-1467 (registration)
    Registration of the tool named 'get_spot_twap_by_user' via the registerTool helper function.
    registerTool(
      "get_spot_twap_by_user",
      "Get Hyperliquid Spot TWAP statuses for a single user wallet across every spot pair. Returns timestamped TWAP status records with coin, twap_id, side, size, filled_size, status, and execution metadata. Sourced from the L4 order stream. Live from 2026-05-05.",
      {
        address: z.string().describe("User wallet address (e.g., '0x1234...')"),
        ...HistoryParams,
      },
      ListOutputSchema,
      async (params) => {
        const { address, start, end, limit, cursor } = params;
        const timeRange = resolveTimeRange(start, end);
        const sdkParams: Record<string, unknown> = {
          ...timeRange,
          limit: resolveLimit(limit),
        };
        if (cursor) sdkParams.cursor = cursor;
        const result = await api().spot.twap.byUser(address, sdkParams as any);
        return formatCursorResponse(result);
      }
    );
  • Generic tool registration helper used by get_spot_twap_by_user. Wraps the SDK call with null-client guard, error formatting, and MCP server registration.
    function registerTool(
      name: string,
      description: string,
      inputSchema: ZodRawShape,
      outputSchema: ZodRawShape,
      handler: (params: any) => Promise<McpContent>
    ): void {
      server.registerTool(
        name,
        {
          description,
          inputSchema,
          outputSchema,
          annotations: TOOL_ANNOTATIONS,
        },
        async (params: any) => {
          if (!client) {
            return {
              content: [{ type: "text" as const, text: MISSING_KEY_MESSAGE }],
              isError: true,
            };
          }
          try {
            return await handler(params);
          } catch (err) {
            const error = err instanceof OxArchiveError ? err : new OxArchiveError(String(err), 500);
            return formatError(error);
          }
        }
      );
    }
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, which describe the tool's safety profile. The description adds extra behavioral context: data source (L4 order stream) and a specific live start date. No contradictions with annotations.

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 three sentences, front-loaded with the primary action and resource. Every sentence adds value: purpose, returned fields, source and temporal scope. No redundancy or filler.

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?

Given the presence of an output schema, the description sufficiently covers purpose, source, and key returned fields. It omits details like pagination or default time ranges, but these are covered by the input schema. The description is adequate for a well-annotated tool.

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?

Input schema has 100% description coverage, so the baseline is 3. The description does not add any parameter-specific meaning beyond the schema (e.g., only mentions 'address' implicitly as 'single user wallet'). No extra semantics provided.

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?

The description clearly identifies the tool's purpose: retrieving Hyperliquid Spot TWAP statuses for a single user wallet across every spot pair. It specifies the returned fields and distinguishes from sibling tool get_spot_twap_by_symbol by focusing on user-level aggregation.

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 a single user wallet across all spot pairs, hinting at differentiation from get_spot_twap_by_symbol (by symbol). However, it lacks explicit when-to-use, when-not-to-use, or alternative tool guidance. The mention of live data from 2026-05-05 is useful for temporal context.

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/0xArchiveIO/0xarchive-mcp'

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