Skip to main content
Glama
trainual

Tiptap Collaboration MCP Server

by trainual

get_server_statistics

Retrieve server-wide metrics such as total documents, active connections, and usage statistics to monitor and manage Tiptap collaborative document services efficiently.

Instructions

Get server-wide statistics including total documents, connections, and usage metrics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that fetches server statistics via API call to /api/statistics, formats the response as text content, and handles errors gracefully.
    async () => {
      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/statistics`, { headers });
    
        if (!response.ok) {
          return {
            content: [
              {
                type: 'text',
                text: `Failed to retrieve server statistics. HTTP error: ${response.status} ${response.statusText}`,
              },
            ],
          };
        }
    
        const statistics = await response.json();
    
        return {
          content: [
            {
              type: 'text',
              text: `Server Statistics: ${JSON.stringify(statistics, null, 2)}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error retrieving server statistics: ${
                error instanceof Error ? error.message : 'Unknown error'
              }`,
            },
          ],
        };
      }
  • Registers the "get-server-statistics" tool on the MCP server using server.tool(), with tool name, description, empty schema, and handler function.
    server.tool(
      'get-server-statistics',
      'Get server-wide statistics including total documents, connections, and usage metrics',
      {},
      async () => {
        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/statistics`, { headers });
    
          if (!response.ok) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Failed to retrieve server statistics. HTTP error: ${response.status} ${response.statusText}`,
                },
              ],
            };
          }
    
          const statistics = await response.json();
    
          return {
            content: [
              {
                type: 'text',
                text: `Server Statistics: ${JSON.stringify(statistics, null, 2)}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving server statistics: ${
                  error instanceof Error ? error.message : 'Unknown error'
                }`,
              },
            ],
          };
        }
      }
    );
  • Empty input schema indicating the tool takes no parameters.
    {},
  • src/server.ts:55-55 (registration)
    Calls the registration function for get_server_statistics tool during main server setup.
    registerGetServerStatistics(server, getBaseUrl, getToken);

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