Skip to main content
Glama
pushkarsingh32

Semantic Pen MCP Server

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
NameRequiredDescriptionDefault
articleIdYesThe ID of the article to retrieve

Implementation Reference

  • 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
        };
      }
    }
  • 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);
    }
  • 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"]
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pushkarsingh32/semantic-pen-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server