Skip to main content
Glama
trainual

Tiptap Collaboration MCP Server

by trainual

export_markdown

Convert Tiptap JSON content into Markdown or GitHub Flavored Markdown (GFM) format using the Tiptap Conversion API, enabling structured document export for collaborative workflows.

Instructions

Convert Tiptap JSON content to Markdown format using the Tiptap Conversion API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesYour Tiptap App ID for the conversion service
contentYesTiptap JSON content to convert to Markdown
formatNoOutput format: md (standard) or gfm (GitHub Flavored Markdown). Default: md

Implementation Reference

  • The handler function that calls the Tiptap conversion API to export JSON content to Markdown or GFM format, handling errors and returning formatted text content.
    async ({ content, format = 'md', appId }) => {
      try {
        const headers: Record<string, string> = {
          'User-Agent': 'tiptap-collaboration-mcp',
          'Content-Type': 'application/json',
          'X-App-Id': appId,
        };
    
        const token = getToken();
        if (token) headers['Authorization'] = `Bearer ${token}`;
    
        const response = await fetch(`${getBaseUrl()}/api/convert/export`, {
          method: 'POST',
          headers,
          body: JSON.stringify({ content, format }),
        });
    
        if (!response.ok) {
          return {
            content: [
              {
                type: 'text',
                text: `Failed to export to markdown. HTTP error: ${response.status} ${response.statusText}. Make sure you have a valid JWT token and App ID for the Tiptap Conversion service.`,
              },
            ],
          };
        }
    
        const markdownContent = await response.text();
    
        return {
          content: [
            {
              type: 'text',
              text: `Tiptap JSON exported to ${format.toUpperCase()} successfully:\n\n${markdownContent}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error exporting to markdown: ${
                error instanceof Error ? error.message : 'Unknown error'
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining input parameters: content (Tiptap JSON), optional format (md/gfm), and appId.
    {
      content: z.object({}).describe('Tiptap JSON content to convert to Markdown'),
      format: z.enum(['md', 'gfm']).optional().describe('Output format: md (standard) or gfm (GitHub Flavored Markdown). Default: md'),
      appId: z.string().describe('Your Tiptap App ID for the conversion service'),
    },
  • The registration function that defines and registers the 'export-markdown' tool on the MCP server, including schema and handler.
    export default function registerExportMarkdown(
      server: McpServer,
      getBaseUrl: () => string,
      getToken: () => string | undefined
    ) {
      server.tool(
        'export-markdown',
        'Export Tiptap JSON content to Markdown format',
        {
          content: z.object({}).describe('Tiptap JSON content to convert to Markdown'),
          format: z.enum(['md', 'gfm']).optional().describe('Output format: md (standard) or gfm (GitHub Flavored Markdown). Default: md'),
          appId: z.string().describe('Your Tiptap App ID for the conversion service'),
        },
        async ({ content, format = 'md', appId }) => {
          try {
            const headers: Record<string, string> = {
              'User-Agent': 'tiptap-collaboration-mcp',
              'Content-Type': 'application/json',
              'X-App-Id': appId,
            };
    
            const token = getToken();
            if (token) headers['Authorization'] = `Bearer ${token}`;
    
            const response = await fetch(`${getBaseUrl()}/api/convert/export`, {
              method: 'POST',
              headers,
              body: JSON.stringify({ content, format }),
            });
    
            if (!response.ok) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Failed to export to markdown. HTTP error: ${response.status} ${response.statusText}. Make sure you have a valid JWT token and App ID for the Tiptap Conversion service.`,
                  },
                ],
              };
            }
    
            const markdownContent = await response.text();
    
            return {
              content: [
                {
                  type: 'text',
                  text: `Tiptap JSON exported to ${format.toUpperCase()} successfully:\n\n${markdownContent}`,
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Error exporting to markdown: ${
                    error instanceof Error ? error.message : 'Unknown error'
                  }`,
                },
              ],
            };
          }
        }
      );
    }
  • src/server.ts:51-51 (registration)
    Invocation of the registerExportMarkdown function to register the tool on the main server instance.
    registerExportMarkdown(server, getBaseUrl, getToken);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the use of an external API ('Tiptap Conversion API') but does not describe error handling, rate limits, authentication needs (implied by appId), or what happens if conversion fails. This is a significant gap for a tool with no annotation coverage.

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 that front-loads the core functionality without unnecessary details. Every word earns its place by specifying the action, input, output, and method, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage context, behavioral traits, and output expectations. With no output schema, it should ideally hint at the return format, but the schema coverage helps offset some gaps.

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 all parameters (appId, content, format) with descriptions and enums. The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints on the content object. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: converting Tiptap JSON content to Markdown format using a specific API. It specifies the verb ('convert'), resource ('Tiptap JSON content'), and target format ('Markdown'), but does not explicitly differentiate from sibling tools like 'import_markdown' (which likely does the reverse operation).

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. The description does not mention prerequisites (e.g., needing a Tiptap App ID), exclusions, or compare it to sibling tools like 'import_markdown' for reverse conversions or other document-related tools in the list.

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