get_article
Retrieve full content of a specific article by entering its unique ID. Designed for accessing detailed articles directly through Semantic Pen MCP Server.
Instructions
Get a specific article by ID with full content
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| articleId | Yes | The ID of the article to retrieve |
Implementation Reference
- src/index.ts:535-579 (handler)Core handler function that fetches article details from the Semantic Pen API by ID, computes word count and content preview, formats status with emoji, and returns structured text response including full HTML availability note.private async getArticle(articleId: string) { const result = await this.makeRequest<ArticleDetail>(`/articles/${articleId}`); if (result.success && result.data) { const article = result.data; const title = article.extra_data?.targetArticleTopic || 'Untitled Article'; const wordCount = article.output ? Math.round(article.output.replace(/<[^>]*>/g, '').split(/\s+/).filter(word => word.length > 0).length) : 0; // Create a clean preview of the content (first 300 characters) const cleanContent = article.output ? article.output .replace(/<[^>]*>/g, '') // Remove HTML tags .replace(/\n\s*\n/g, '\n') // Remove extra newlines .trim() : 'Content not yet generated'; const preview = cleanContent.length > 300 ? cleanContent.substring(0, 300) + '...' : cleanContent; const statusEmoji = article.status === 'finished' ? '✅' : article.status === 'processing' ? '🔄' : article.status === 'failed' ? '❌' : '⏳'; return { content: [ { type: "text", text: `📄 **${title}**\n\n${statusEmoji} **Status:** ${article.status} (${article.progress}%)\n**Article ID:** ${article.id}\n**Project:** ${article.project_name}\n**Created:** ${new Date(article.created_at).toLocaleDateString()}\n**Word Count:** ~${wordCount} words\n\n**Settings:**\n- Target Keyword: ${article.config?.targetKeyword || 'N/A'}\n- Language: ${article.config?.language || 'English'}\n- Type: ${article.config?.articleType || 'Article'}\n- Tone: ${article.config?.toneOfVoice || 'Professional'}\n- Target Words: ${article.config?.wordCount || 'N/A'}\n\n**Content Preview:**\n${preview}\n\n---\n💡 **Full HTML Content Available:** The complete article HTML is in the \`output\` field and can be used for publishing or further editing.` } ] }; } else { return { content: [ { type: "text", text: `❌ Failed to fetch article: ${result.error}` } ], isError: true }; } }
- src/index.ts:269-282 (registration)Tool registration in the MCP server's listTools handler, defining name, description, and input schema requiring 'articleId' string.{ name: "get_article", description: "Get a specific article by ID with full content", inputSchema: { type: "object", properties: { articleId: { type: "string", description: "The ID of the article to retrieve" } }, required: ["articleId"] } }
- src/index.ts:326-331 (handler)Dispatch handler in the CallToolRequestSchema that validates input arguments and invokes the getArticle method.case "get_article": { if (!args || typeof args !== 'object' || !('articleId' in args) || typeof args.articleId !== 'string') { throw new Error("articleId is required and must be a string"); } return await this.getArticle(args.articleId); }
- src/index.ts:272-281 (schema)Input schema definition for the get_article tool, specifying required 'articleId' parameter.inputSchema: { type: "object", properties: { articleId: { type: "string", description: "The ID of the article to retrieve" } }, required: ["articleId"] }