Skip to main content
Glama

outline_create_document

Create new documents in Outline with Markdown content, titles, and optional organization into collections or nested structures.

Instructions

Create a new document in Outline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesThe title of the document
textYesThe content of the document in Markdown format
collectionIdNoOptional collection ID to create the document in
parentDocumentIdNoOptional parent document ID for nested documents
publishNoWhether to publish the document immediately (default: false)

Implementation Reference

  • The actual implementation of the 'createDocument' method in the OutlineClient class, which interacts with the Outline API.
    async createDocument(data: {
      title: string;
      text: string;
      collectionId?: string;
      parentDocumentId?: string;
      publish?: boolean;
    }): Promise<Document> {
      const payload: any = {
        title: data.title,
        text: data.text,
        publish: data.publish || false,
      };
    
      if (data.collectionId) {
        payload.collection = data.collectionId;
      }
      if (data.parentDocumentId) {
        payload.parentDocumentId = data.parentDocumentId;
      }
    
      const endpoints = ['/api/documents.create', '/api/documents/create', '/api/documents', '/api/document/create'];
    
      for (const endpoint of endpoints) {
        try {
          const response = await this.api.post(endpoint, payload);
          return response.data.data || response.data;
        } catch (error: any) {
          if (error.response?.status === 404 && endpoint !== endpoints[endpoints.length - 1]) {
            console.error(`Endpoint ${endpoint} not found, trying next...`);
            continue;
          }
          throw error;
        }
      }
      throw new Error('No valid endpoint found for creating document');
    }
  • The MCP handler block that calls 'outlineClient.createDocument' when the 'outline_create_document' tool is invoked.
    case 'outline_create_document':
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              await this.outlineClient.createDocument({
                title: args.title as string,
                text: args.text as string,
                collectionId: args.collectionId as string,
                parentDocumentId: args.parentDocumentId as string,
                publish: args.publish as boolean,
              }),
              null,
              2
            ),
          },
        ],
      };
  • The MCP schema definition for the 'outline_create_document' tool.
      name: 'outline_create_document',
      description: 'Create a new document in Outline',
      inputSchema: {
        type: 'object',
        properties: {
          title: {
            type: 'string',
            description: 'The title of the document',
          },
          text: {
            type: 'string',
            description: 'The content of the document in Markdown format',
          },
          collectionId: {
            type: 'string',
            description: 'Optional collection ID to create the document in',
          },
          parentDocumentId: {
            type: 'string',
            description: 'Optional parent document ID for nested documents',
          },
          publish: {
            type: 'boolean',
            description: 'Whether to publish the document immediately (default: false)',
            default: false,
          },
        },
        required: ['title', 'text'],
      },
    },

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/HelicopterHelicopter/outline-mcp-server'

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