get_workspace
Retrieve detailed information about a specific AFFiNE workspace using its unique ID, enabling efficient workspace management and operations.
Instructions
Get details of a specific workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Workspace ID |
Implementation Reference
- src/tools/workspaces.ts:164-183 (handler)The main handler function for the 'get_workspace' tool. It takes a workspace ID, executes a GraphQL query to fetch workspace details including id, public status, AI enablement, creation date, and permissions, then returns the data or an error.const getWorkspaceHandler = async ({ id }: { id: string }) => { try { const query = `query GetWorkspace($id: String!) { workspace(id: $id) { id public enableAi createdAt permissions { Workspace_Read Workspace_CreateDoc } } }`; const data = await gql.request<{ workspace: any }>(query, { id }); return text(data.workspace); } catch (error: any) { return text({ error: error.message }); } };
- src/tools/workspaces.ts:185-195 (registration)Registers the 'get_workspace' tool with the MCP server, specifying the tool name, title, description, input schema requiring a string 'id', and linking to the getWorkspaceHandler function.server.registerTool( "get_workspace", { title: "Get Workspace", description: "Get details of a specific workspace", inputSchema: { id: z.string().describe("Workspace ID") } }, getWorkspaceHandler as any );
- src/tools/workspaces.ts:190-192 (schema)Input schema definition for the tool using Zod: requires a string 'id' parameter for the workspace ID.inputSchema: { id: z.string().describe("Workspace ID") }