Skip to main content
Glama

List Histories

list_histories

Retrieve timestamps of document revisions to track changes and access version history.

Instructions

List doc histories (timestamps) for a doc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceIdNo
guidYes
takeNo
beforeNo

Implementation Reference

  • The `listHistoriesHandler` async function that executes the tool logic: resolves workspaceId, executes a GraphQL query to fetch doc histories (id, timestamp, workspaceId), and returns the result as text.
    const listHistoriesHandler = async (parsed: { workspaceId?: string; guid: string; take?: number; before?: string }) => {
      const workspaceId = parsed.workspaceId || defaults.workspaceId || parsed.workspaceId;
      if (!workspaceId) throw new Error("workspaceId required (or set AFFINE_WORKSPACE_ID)");
      const query = `query Histories($workspaceId:String!,$guid:String!,$take:Int,$before:DateTime){ workspace(id:$workspaceId){ histories(guid:$guid, take:$take, before:$before){ id timestamp workspaceId } } }`;
      const data = await gql.request<{ workspace: any }>(query, { workspaceId, guid: parsed.guid, take: parsed.take, before: parsed.before });
      return text(data.workspace.histories);
    };
  • Registration of the 'list_histories' tool with `server.registerTool()`, including input schema (workspaceId optional, guid required, take optional number, before optional string).
    server.registerTool(
      "list_histories",
      {
        title: "List Histories",
        description: "List doc histories (timestamps) for a doc.",
        inputSchema: {
          workspaceId: z.string().optional(),
          guid: z.string(),
          take: z.number().optional(),
          before: z.string().optional()
        }
      },
      listHistoriesHandler as any
    );
  • src/index.ts:182-182 (registration)
    Top-level registration call: `registerHistoryTools(server, gql, { workspaceId: config.defaultWorkspaceId })` in index.ts.
    registerHistoryTools(server, gql, { workspaceId: config.defaultWorkspaceId });
  • The `text()` helper function used by the handler to format the response as MCP text content.
    export function text(data: unknown) {
      if (typeof data === "string") {
        return { content: [{ type: "text" as const, text: data }] };
      }
    
      if (data !== null && typeof data === "object" && !Array.isArray(data)) {
        const structuredContent = cloneJsonValue(data);
        return {
          content: [{ type: "text" as const, text: JSON.stringify(structuredContent) }],
          structuredContent,
        };
      }
    
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data) }],
      };
    }
  • Permission/scope mapping for 'list_histories' in toolSurface.ts: requires 'history', 'history.read', 'read' scopes.
    list_histories: ["history", "history.read", "read"],
Behavior2/5

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

No annotations provided; description is minimal with no mention of read-only or other behavioral traits. It does not disclose side effects, permissions, or pagination behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One concise sentence, front-loaded with key action. Could include a bit more detail without losing conciseness.

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?

With four parameters and no output schema, the description is too sparse. Does not explain parameter usage, return format, or pagination constraints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% and the description adds no explanation for the four parameters (workspaceId, guid, take, before). Does not compensate for missing schema descriptions.

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?

Description clearly states 'List doc histories (timestamps) for a doc', identifying a specific verb and resource. It distinguishes from sibling tools like 'list_docs' which list documents themselves.

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 on when to use this tool versus alternatives, or any exclusions. With many sibling tools, this omission reduces clarity for selection.

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/DAWNCR0W/affine-mcp-server'

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