write-text
Write and manage text in Textwell app using three modes: replace, insert, or add content. Integrate via MCP for efficient text operations in your workflow.
Instructions
Write text to Textwell application
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | replace: overwrite all, insert: at cursor, add: at end | replace |
| text | Yes | Content to write to Textwell |
Implementation Reference
- src/server.ts:92-120 (handler)Handler function for the 'write-text' tool. Extracts text and mode from arguments, logs the action, constructs a URL using URL_SCHEMES[mode], encodes the text, and executes it via executeUrlScheme. Returns success message or throws error.case 'write-text': { const { text, mode = 'replace' } = request.params.arguments as { text: string; mode?: 'replace' | 'insert' | 'add'; }; this.server.sendLoggingMessage({ level: "info", data: `Textwell: ${mode} text` }); const encodedText = encodeURIComponent(text); const url = `${URL_SCHEMES[mode]}?text=${encodedText}`; try { await this.executeUrlScheme(url); return { content: [{ type: 'text', text: `Text ${mode} completed` }] }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Textwell write failed: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/server.ts:66-81 (schema)Input schema definition for the 'write-text' tool, including required 'text' parameter and optional 'mode' with enum values.inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Content to write to Textwell' }, mode: { type: 'string', enum: ['replace', 'insert', 'add'], description: 'replace: overwrite all, insert: at cursor, add: at end', default: 'replace' } }, required: ['text'] }
- src/server.ts:63-83 (registration)Registration of the 'write-text' tool in the ListToolsRequestSchema handler, providing name, description, and input schema.{ name: 'write-text', description: 'Write text to Textwell application', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Content to write to Textwell' }, mode: { type: 'string', enum: ['replace', 'insert', 'add'], description: 'replace: overwrite all, insert: at cursor, add: at end', default: 'replace' } }, required: ['text'] } } ]