Skip to main content
Glama

Publish Document

publish_doc

Make documents publicly accessible by specifying the workspace and document ID using the 'publish_doc' tool on AFFiNE MCP Server, supporting both Page and Edgeless modes.

Instructions

Publish a doc (make public).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docIdYes
modeNo
workspaceIdNo

Implementation Reference

  • The handler function that performs the actual logic of publishing a document via GraphQL mutation.
    const publishDocHandler = async (parsed: { workspaceId?: string; docId: string; mode?: "Page" | "Edgeless" }) => {
        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.");
        }
        const mutation = `mutation PublishDoc($workspaceId:String!,$docId:String!,$mode:PublicDocMode){ publishDoc(workspaceId:$workspaceId, docId:$docId, mode:$mode){ id workspaceId public mode } }`;
        const data = await gql.request<{ publishDoc: any }>(mutation, { workspaceId, docId: parsed.docId, mode: parsed.mode });
        return text(data.publishDoc);
      };
  • Zod input schema defining parameters for the publish_doc tool: workspaceId (optional), docId (required), mode (optional: Page or Edgeless).
    inputSchema: {
      workspaceId: z.string().optional(),
      docId: z.string(),
      mode: z.enum(["Page","Edgeless"]).optional()
    }
  • Registration of the 'publish_doc' tool with the MCP server, including title, description, input schema, and handler reference.
    server.registerTool(
      "publish_doc",
      {
        title: "Publish Document",
        description: "Publish a doc (make public).",
        inputSchema: {
          workspaceId: z.string().optional(),
          docId: z.string(),
          mode: z.enum(["Page","Edgeless"]).optional()
        }
      },
      publishDocHandler as any
    );
  • Alias registration of the 'affine_publish_doc' tool using the same handler.
    server.registerTool(
      "affine_publish_doc",
      {
        title: "Publish Document",
        description: "Publish a doc (make public).",
        inputSchema: {
          workspaceId: z.string().optional(),
          docId: z.string(),
          mode: z.enum(["Page","Edgeless"]).optional()
        }
      },
      publishDocHandler as any
    );
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions 'make public' but doesn't disclose critical traits like whether this is reversible, requires authentication, affects document visibility, or has side effects (e.g., notifications). The description is too sparse for a mutation tool.

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?

The description is very concise (one short sentence) and front-loaded with the core action. However, it's arguably too brief, bordering on under-specified rather than efficiently informative, though it avoids unnecessary words.

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 a mutation tool with 3 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It lacks details on behavior, parameters, return values, and error conditions, making it inadequate for safe and effective use by an agent.

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 description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'docId', 'mode', or 'workspaceId' mean, their formats, or how they affect publication (e.g., 'mode' enum values 'Page' vs 'Edgeless'). This leaves parameters largely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('Publish') and resource ('a doc'), but is vague about what 'make public' entails (e.g., sharing link, permissions change). It distinguishes from siblings like 'get_doc' or 'revoke_doc' by indicating a state change, but lacks specificity about the publication mechanism.

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 is provided. It doesn't mention prerequisites (e.g., needing edit permissions), exclusions, or how it differs from similar tools like 'revoke_doc' (which might undo publication). Usage is implied only by the action name.

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