Skip to main content
Glama

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

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