Skip to main content
Glama

Recent Documents

recent_docs

Retrieve a list of recently updated documents in a specified workspace using the GraphQL API. Manage document operations efficiently with input parameters like workspace ID and pagination options.

Instructions

List recently updated docs in a workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNo
firstNo
offsetNo
workspaceIdNo

Implementation Reference

  • The main handler function for the 'recent_docs' tool. It performs a GraphQL query to list documents in the workspace (using the standard docs field as a proxy for recent docs).
    const recentDocsHandler = async (parsed: { workspaceId?: string; first?: number; offset?: number; after?: string }) => {
        const workspaceId = parsed.workspaceId || defaults.workspaceId;
        if (!workspaceId) {
          throw new Error("workspaceId is required. Provide it as a parameter or set AFFINE_WORKSPACE_ID in environment.");
        }
        // Note: AFFiNE doesn't have a separate 'recentlyUpdatedDocs' field, just use docs
        const query = `query RecentDocs($workspaceId:String!, $first:Int, $offset:Int, $after:String){ workspace(id:$workspaceId){ docs(pagination:{first:$first, offset:$offset, after:$after}){ totalCount pageInfo{ hasNextPage endCursor } edges{ cursor node{ id workspaceId title summary public defaultRole createdAt updatedAt } } } } }`;
        const data = await gql.request<{ workspace: any }>(query, { workspaceId, first: parsed.first, offset: parsed.offset, after: parsed.after });
        return text(data.workspace.docs);
      };
  • Registration of the 'recent_docs' tool with the MCP server, including input schema and handler reference.
    server.registerTool(
      "recent_docs",
      {
        title: "Recent Documents",
        description: "List recently updated docs in a workspace.",
        inputSchema: {
          workspaceId: z.string().optional(),
          first: z.number().optional(),
          offset: z.number().optional(),
          after: z.string().optional()
        }
      },
      recentDocsHandler as any
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states 'List recently updated docs', implying a read-only operation, but fails to disclose behavioral traits like pagination (suggested by parameters 'after', 'first', 'offset'), rate limits, authentication needs, or what 'recently updated' means (e.g., time frame). This is inadequate for a tool with multiple parameters and no annotation coverage.

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 that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized for a basic listing tool, with zero waste.

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?

Given the complexity (4 parameters, 0% schema coverage, no annotations, no output schema), the description is incomplete. It lacks details on parameter usage, behavioral context, and output expectations, making it insufficient for an agent to reliably invoke the tool without additional context.

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?

The schema description coverage is 0%, so the description must compensate. It mentions 'workspace' which aligns with 'workspaceId', but doesn't explain the other three parameters ('after', 'first', 'offset') or their roles in filtering/pagination. This adds minimal value beyond the schema, failing to address the coverage gap.

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 ('List') and resource ('recently updated docs in a workspace'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_docs' or 'search_docs', which might also retrieve documents, so it lacks specific sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives such as 'list_docs' or 'search_docs'. It mentions a workspace context but offers no explicit when/when-not rules or prerequisites, leaving usage unclear relative to siblings.

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

Related 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