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
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | The title of the document | |
| text | Yes | The content of the document in Markdown format | |
| collectionId | No | Optional collection ID to create the document in | |
| parentDocumentId | No | Optional parent document ID for nested documents | |
| publish | No | Whether to publish the document immediately (default: false) |
Implementation Reference
- src/outline-client.ts:111-146 (handler)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'); } - src/index.ts:235-253 (handler)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 ), }, ], }; - src/index.ts:65-94 (schema)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'], }, },