Skip to main content
Glama

pot_query

Query Proof of Time history from local logs and on-chain subgraph to verify transaction timing and resolve payment disputes.

Instructions

Query Proof of Time history from local log and on-chain subgraph.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startTimeNoStart time (unix ms). Default: 24h ago
endTimeNoEnd time (unix ms). Default: now
limitNoMax entries to return. Default: 100, max: 1000

Implementation Reference

  • The 'potQuery' function implements the 'pot_query' tool, which retrieves proof-of-time anchor logs filtered by time and limit, combining in-memory logs with data from a subgraph.
    export async function potQuery(args: {
      startTime?: number;
      endTime?: number;
      limit?: number;
    }): Promise<unknown> {
      telemetryIncrement("pot_query");
    
      const limit = Math.min(args.limit ?? 100, 1000);
      const now = Date.now();
      const startTime = args.startTime ?? now - 86400_000;
      const endTime = args.endTime ?? now;
    
      // Filter from in-memory log
      const filtered = potLog
        .filter((e) => e.createdAt >= startTime && e.createdAt <= endTime)
        .slice(-limit);
    
      // Best-effort subgraph query
      let subgraphEntries: unknown[] = [];
      try {
        const query = `{
          potAnchors(
            first: ${limit},
            orderBy: blockTimestamp,
            orderDirection: desc,
            where: { blockTimestamp_gte: "${Math.floor(startTime / 1000)}", blockTimestamp_lte: "${Math.floor(endTime / 1000)}" }
          ) {
            id
            potHash
            blockTimestamp
            txHash
          }
        }`;
    
        const controller = new AbortController();
        const timeout = setTimeout(() => controller.abort(), 5000);
        const resp = await fetch(SUBGRAPH_URL, {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ query }),
          signal: controller.signal,
        });
        clearTimeout(timeout);
    
        if (resp.ok) {
          const json = (await resp.json()) as { data?: { potAnchors?: unknown[] } };
          subgraphEntries = json.data?.potAnchors ?? [];
        }
      } catch {
        // Subgraph unavailable — local log still returned
      }
    
      return serialize({
        local: filtered,
        subgraph: subgraphEntries,
        totalLocal: potLog.length,
        query: { startTime, endTime, limit },
      });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does without behavioral details. It doesn't disclose whether this is a read-only operation, potential rate limits, authentication needs, or what happens if data sources are unavailable. For a query tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 with zero wasted words. It front-loads the core purpose ('Query Proof of Time history') and specifies data sources concisely. Every element earns its place without redundancy.

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 tool's moderate complexity (querying multiple data sources), lack of annotations, and no output schema, the description is minimally adequate. It states what the tool does but doesn't explain return values, error conditions, or behavioral traits. With 100% schema coverage, parameters are well-documented, but overall completeness is limited for a query tool without output 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?

Schema description coverage is 100%, so the input schema fully documents all three parameters with defaults and constraints. The description adds no additional parameter semantics beyond implying time-based filtering, which is already covered in the schema. This meets the baseline for high schema coverage.

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 ('Query') and resource ('Proof of Time history'), specifying both data sources ('local log and on-chain subgraph'). It distinguishes from siblings like 'pot_generate' or 'pot_verify' by focusing on retrieval rather than creation or validation. However, it doesn't explicitly contrast with 'pot_stats' which might also involve querying.

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?

No guidance is provided on when to use this tool versus alternatives like 'pot_stats' or 'pot_verify'. The description implies it's for historical queries, but there's no explicit context, prerequisites, or exclusions mentioned to help an agent choose between sibling tools.

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/Helm-Protocol/openttt-mcp'

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