getWatchtowerContent
Retrieve and format Watchtower article content by processing RTF files into clean, structured plain text for study and reference purposes.
Instructions
STEP 2: Get the actual Watchtower article content after user chooses an article. Use this tool AFTER getWatchtowerLinks when user specifies which article they want (e.g., "Imitate the Faithful Angels" or "Look to Jehovah for Comfort"). Takes the RTF URL from Step 1 results, downloads the RTF file, parses it to clean plain text, and returns the formatted article content with proper structure and line breaks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The RTF file URL from getWatchtowerLinks results (e.g., "https://cfp2.jw-cdn.org/a/...") |
Implementation Reference
- src/tools/watchtower-tools.js:39-56 (handler)The core handler function that downloads the RTF content from the provided URL using downloadRtfContent and parses it to plain text using parseRTF, returning structured results including the parsed text.export async function getWatchtowerContent(url) { const rtfData = await downloadRtfContent(url); try { // Parse RTF to plain text const parsedText = parseRTF(rtfData.content); return { url: rtfData.url, contentType: rtfData.contentType, originalSize: rtfData.size, parsedText: parsedText, parsedSize: parsedText.length }; } catch (error) { throw new Error(`Failed to parse RTF content: ${error.message}`); } }
- src/tools/watchtower-tools.js:89-102 (registration)The tool registration object defining name, description, and input schema for getWatchtowerContent within the exported watchtowerTools array.{ name: 'getWatchtowerContent', description: 'STEP 2: Get the actual Watchtower article content after user chooses an article. Use this tool AFTER getWatchtowerLinks when user specifies which article they want (e.g., "Imitate the Faithful Angels" or "Look to Jehovah for Comfort"). Takes the RTF URL from Step 1 results, downloads the RTF file, parses it to clean plain text, and returns the formatted article content with proper structure and line breaks.', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The RTF file URL from getWatchtowerLinks results (e.g., "https://cfp2.jw-cdn.org/a/...")' } }, required: ['url'] } }
- src/tools/watchtower-tools.js:134-172 (handler)The MCP-specific tool handler logic within handleWatchtowerTools that processes requests for getWatchtowerContent, validates input, calls the core handler, and formats the response.// Handle getWatchtowerContent tool if (request.params.name === 'getWatchtowerContent') { try { const { url } = request.params.arguments; if (!url) { return { content: [ { type: 'text', text: 'Error: URL parameter is required', }, ], isError: true, }; } const result = await getWatchtowerContent(url); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error: ${error.message}`, }, ], isError: true, }; } }
- src/tools/watchtower-tools.js:92-101 (schema)Input schema definition for the getWatchtowerContent tool, specifying the required 'url' parameter.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The RTF file URL from getWatchtowerLinks results (e.g., "https://cfp2.jw-cdn.org/a/...")' } }, required: ['url'] }