Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesWorkspace ID

Implementation Reference

  • 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 });
      }
    };
  • 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
    );
  • Input schema definition for the tool using Zod: requires a string 'id' parameter for the workspace ID.
    inputSchema: { 
      id: z.string().describe("Workspace ID") 
    }

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