quip_append_content
Add new content to existing Quip documents by appending markdown text to specified document threads.
Instructions
Append content to an existing Quip document
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"threadId": "<threadId>",
"content": "<content>"
},
"name": "quip_append_content"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes | The Quip document thread ID | |
| content | Yes | Markdown content to append to the document |
Implementation Reference
- src/index.ts:159-165 (handler)Handler for the 'quip_append_content' tool: validates arguments and calls editDocument with 'APPEND' operation to append content to a Quip document.
case 'quip_append_content': { const typedArgs = args as any; if (!typedArgs.threadId || !typedArgs.content) { throw new McpError(ErrorCode.InvalidParams, 'threadId and content are required'); } return await this.editDocument(String(typedArgs.threadId), String(typedArgs.content), 'APPEND'); } - src/index.ts:66-82 (registration)Registration of the 'quip_append_content' tool in the listTools response, including name, description, and input schema.
name: 'quip_append_content', description: 'Append content to an existing Quip document', inputSchema: { type: 'object', properties: { threadId: { type: 'string', description: 'The Quip document thread ID' }, content: { type: 'string', description: 'Markdown content to append to the document' } }, required: ['threadId', 'content'], }, }, - src/index.ts:235-268 (helper)Helper method that implements the core logic for editing Quip documents (used by append, prepend, replace): writes content to temp file and executes quip_edit.py script.
private async editDocument(threadId: string, content: string, operation: string) { try { console.log(`Editing document ${threadId} with operation ${operation}...`); // Create a temporary file to store the content const tempFilePath = `/tmp/quip_content_${Date.now()}.md`; const writeCommand = `echo "${content.replace(/"/g, '\\"')}" > ${tempFilePath}`; await execAsync(writeCommand); // Execute the Python script to edit the document const command = `python -u ${path.join(SCRIPTS_DIR, 'quip_edit.py')} ${threadId} ${operation.toLowerCase()} ${tempFilePath}`; const { stdout, stderr } = await execAsync(command); // Clean up the temporary file await execAsync(`rm ${tempFilePath}`); if (stderr) { console.error(`Error editing document: ${stderr}`); throw new Error(stderr); } return { content: [ { type: 'text', text: stdout || `Successfully ${operation.toLowerCase()}ed content to document ${threadId}`, }, ], }; } catch (error) { console.error(`Error ${operation.toLowerCase()}ing document:`, error); throw error; } }