Skip to main content
Glama
trainual

Tiptap Collaboration MCP Server

by trainual

get_document

Retrieve detailed information about a collaborative document by specifying its unique ID. The tool works with the Tiptap Collaboration MCP Server to manage document interactions.

Instructions

Get information about a collaborative document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the document to retrieve

Implementation Reference

  • The core handler function for the 'get-document' tool. It makes an HTTP request to the API to fetch document information based on the provided ID, handles authentication, parses the response, and returns formatted text content or an error message.
      async ({ id }) => {
        try {
          const headers: Record<string, string> = {
            'User-Agent': 'tiptap-collaboration-mcp',
            'Content-Type': 'application/json',
          };
          
          const token = getToken();
          if (token) headers['Authorization'] = token;
    
          const response = await fetch(`${getBaseUrl()}/api/documents/${id}`, { headers });
          
          if (!response.ok) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Document with ID ${id} not found. HTTP error: ${response.status} ${response.statusText}`,
                },
              ],
            };
          }
    
          const documentData = await response.json();
    
          return {
            content: [
              {
                type: 'text',
                text: `Document Information: ${JSON.stringify(
                  documentData,
                  null,
                  2
                )}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving document: ${
                  error instanceof Error ? error.message : 'Unknown error'
                }`,
              },
            ],
          };
        }
      }
    );
  • Input schema definition using Zod, specifying a required 'id' string parameter for the document ID.
    {
      id: z.string().describe('ID of the document to retrieve'),
    },
  • The registration function exported from the tool file, which calls server.tool() to register the 'get-document' tool with its name, description, schema, and handler on the MCP server.
    export default function registerGetDocument(
      server: McpServer,
      getBaseUrl: () => string,
      getToken: () => string | undefined
    ) {
      server.tool(
        'get-document',
        'Get information about a collaborative document',
        {
          id: z.string().describe('ID of the document to retrieve'),
        },
        async ({ id }) => {
          try {
            const headers: Record<string, string> = {
              'User-Agent': 'tiptap-collaboration-mcp',
              'Content-Type': 'application/json',
            };
            
            const token = getToken();
            if (token) headers['Authorization'] = token;
    
            const response = await fetch(`${getBaseUrl()}/api/documents/${id}`, { headers });
            
            if (!response.ok) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Document with ID ${id} not found. HTTP error: ${response.status} ${response.statusText}`,
                  },
                ],
              };
            }
    
            const documentData = await response.json();
    
            return {
              content: [
                {
                  type: 'text',
                  text: `Document Information: ${JSON.stringify(
                    documentData,
                    null,
                    2
                  )}`,
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Error retrieving document: ${
                    error instanceof Error ? error.message : 'Unknown error'
                  }`,
                },
              ],
            };
          }
        }
      );
    }
  • src/server.ts:53-53 (registration)
    The call to register the 'get-document' tool on the main MCP server instance.
    registerGetDocument(server, getBaseUrl, getToken);
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does without disclosing behavioral traits. It doesn't mention permissions, rate limits, error handling, or what 'information' includes, leaving significant gaps for a read operation.

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 with no wasted words, clearly front-loading the purpose. It's appropriately sized for a simple tool.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'information' is returned, potential errors, or other contextual details needed for effective use, especially among many sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the 'id' parameter. The description adds no additional meaning beyond implying retrieval by ID, meeting the baseline for high schema coverage without compensating with extra details.

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 'Get' and resource 'collaborative document', making the purpose understandable. It distinguishes from siblings like 'list_documents' or 'search_documents' by focusing on retrieving a specific document, though it doesn't explicitly name these alternatives.

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 is provided on when to use this tool versus alternatives like 'list_documents' or 'search_documents'. The description implies usage for retrieving a specific document by ID, but lacks explicit context or exclusions.

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/trainual/tiptap-collaboration-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server