Skip to main content
Glama

Tiptap Collaboration MCP Server

by trainual
delete-document.ts1.84 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; export default function registerDeleteDocument( server: McpServer, getBaseUrl: () => string, getToken: () => string | undefined ) { server.tool( 'delete-document', 'Delete a collaborative document', { id: z.string().describe('ID of the document to delete'), }, 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}`, { method: 'DELETE', headers, }); if (!response.ok) { if (response.status === 404) { return { content: [ { type: 'text', text: `Document with ID ${id} not found.`, }, ], }; } return { content: [ { type: 'text', text: `Failed to delete document. HTTP error: ${response.status} ${response.statusText}`, }, ], }; } return { content: [ { type: 'text', text: `Document with ID ${id} deleted successfully.`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error deleting document: ${ error instanceof Error ? error.message : 'Unknown error' }`, }, ], }; } } ); }

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