create-document
Create documents in Shortcut project management with HTML-formatted content and titles. Generate new documents that include IDs, titles, and direct app URLs for easy access.
Instructions
Create a new document in Shortcut with a title and content. Returns the document's id, title, and app_url. Note: Use HTML markup for the content (e.g., , , , ) rather than Markdown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | The title for the new document (max 256 characters) | |
| content | Yes | The content for the new document in HTML format (e.g., <p>Hello</p>, <h1>Title</h1>, <ul><li>Item</li></ul>) |
Input Schema (JSON Schema)
{
"properties": {
"content": {
"description": "The content for the new document in HTML format (e.g., <p>Hello</p>, <h1>Title</h1>, <ul><li>Item</li></ul>)",
"type": "string"
},
"title": {
"description": "The title for the new document (max 256 characters)",
"maxLength": 256,
"type": "string"
}
},
"required": [
"title",
"content"
],
"type": "object"
}
Implementation Reference
- src/tools/documents.ts:25-41 (handler)The handler function that executes the tool logic: creates a new document using the Shortcut client with given title and HTML content, handles errors, and returns id, title, app_url or error message.private async createDocument(title: string, content: string) { try { const doc = await this.client.createDoc({ title, content, }); return this.toResult("Document created successfully", { id: doc.id, title: doc.title, app_url: doc.app_url, }); } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error"; return this.toResult(`Failed to create document: ${errorMessage}`); } }
- src/tools/documents.ts:13-20 (schema)Input schema validation using Zod: title (string, max 256 chars) and content (string with HTML description).{ title: z.string().max(256).describe("The title for the new document (max 256 characters)"), content: z .string() .describe( "The content for the new document in HTML format (e.g., <p>Hello</p>, <h1>Title</h1>, <ul><li>Item</li></ul>)", ), },
- src/tools/documents.ts:10-22 (registration)Registration of the 'create-document' tool on the MCP server, including name, description, input schema, and handler reference.server.tool( "create-document", "Create a new document in Shortcut with a title and content. Returns the document's id, title, and app_url. Note: Use HTML markup for the content (e.g., <p>, <h1>, <ul>, <strong>) rather than Markdown.", { title: z.string().max(256).describe("The title for the new document (max 256 characters)"), content: z .string() .describe( "The content for the new document in HTML format (e.g., <p>Hello</p>, <h1>Title</h1>, <ul><li>Item</li></ul>)", ), }, async ({ title, content }) => await tools.createDocument(title, content), );