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"]
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds that the tool returns 'full content', which is useful beyond the name, but it does not mention error handling (e.g., 404 if article not found), permission requirements, or response structure. For a read-only operation this is somewhat acceptable, but deeper context would improve transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, front-loaded, and contains no wasted words. It efficiently conveys the core action, target, and result in a compact form.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity tool with one parameter and no output schema, the description provides sufficient context to select and invoke it correctly. It clarifies that the response includes the full article content, which is the key missing piece an agent would need. It could add error behavior details, but given the simplicity and sibling context, it is mostly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already describes the only parameter (articleId) with 100% coverage. The description merely repeats 'by ID' and adds no additional meaning about the parameter's format, constraints, or behavior. Since schema coverage is high, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get'), the resource ('a specific article'), and the scope ('by ID with full content'). It distinguishes from sibling tools like get_project_articles (which likely retrieves articles belonging to a project) and search_projects (which searches projects), making its purpose precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the proper use case: retrieving a full article when you already have its ID. It does not explicitly mention alternatives or exclusions, but the sibling tool names provide context. The phrase 'by ID' signals that this is for targeted retrieval rather than listing or searching, offering clear context without explicit when-not-to-use directions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.