get_article
Retrieve full article content by ID for editing, analysis, or integration within the Semantic Pen MCP Server's AI-powered content workflow.
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)The primary handler function that executes the 'get_article' tool logic. It makes an API request to fetch article details, processes the response (calculates word count, generates preview, formats status), and returns a structured MCP response with text content.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:272-281 (schema)The input schema for the 'get_article' tool, specifying that 'articleId' (string) is required.inputSchema: { type: "object", properties: { articleId: { type: "string", description: "The ID of the article to retrieve" } }, required: ["articleId"] }
- src/index.ts:326-331 (registration)Registration and dispatch logic in the CallToolRequestHandler: validates input arguments and invokes the getArticle handler.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:270-282 (schema)Full tool specification in ListToolsRequestHandler, including name, description, and input schema.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"] } }