Skip to main content
Glama
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

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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "appId": { "description": "Your Tiptap App ID for the conversion service", "type": "string" }, "content": { "additionalProperties": false, "description": "Tiptap JSON content to convert to Markdown", "properties": {}, "type": "object" }, "format": { "description": "Output format: md (standard) or gfm (GitHub Flavored Markdown). Default: md", "enum": [ "md", "gfm" ], "type": "string" } }, "required": [ "content", "appId" ], "type": "object" }

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);

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