Skip to main content
Glama
pushkarsingh32

Semantic Pen MCP Server

get_project_articles

Retrieve all articles from a specific project using its project ID to manage and access content within the Semantic Pen MCP Server.

Instructions

Get all articles from a specific project by project ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe project ID to get articles from

Implementation Reference

  • The primary handler function `getProjectArticles` that executes the tool logic: fetches articles for the given project ID via API, processes them (e.g., word count estimation), and returns a formatted list.
    private async getProjectArticles(projectId: string) {
      const result = await this.makeRequest<ProjectArticlesResponse>(`/article-queue/${projectId}`);
      
      if (result.success && result.data) {
        const articles = result.data.data.articles;
    
        if (articles.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No articles found in project ${projectId}`
              }
            ]
          };
        }
    
        const articleList = articles.map(article => {
          const wordCount = article.html ? 
            Math.round(article.html.replace(/<[^>]*>/g, '').split(/\s+/).filter(word => word.length > 0).length) : 0;
          
          return `πŸ“„ **${article.title}**\n   ID: ${article.id}\n   Word Count: ~${wordCount} words\n   Created: ${new Date(article.created_at).toLocaleDateString()}\n   Keyword: ${article.setting?.targetKeyword || 'N/A'}`;
        }).join('\n\n');
    
        return {
          content: [
            {
              type: "text",
              text: `πŸ“š **Project Articles** (${result.data.count} articles)\n**Project ID:** ${projectId}\n\n${articleList}`
            }
          ]
        };
      } else {
        return {
          content: [
            {
              type: "text",
              text: `❌ Failed to fetch project articles: ${result.error}`
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:203-216 (registration)
    Tool registration in the list of tools provided by ListToolsRequestHandler, including name, description, and input schema.
    {
      name: "get_project_articles",
      description: "Get all articles from a specific project by project ID",
      inputSchema: {
        type: "object",
        properties: {
          projectId: {
            type: "string",
            description: "The project ID to get articles from"
          }
        },
        required: ["projectId"]
      }
    },
  • Input schema definition for the tool, specifying that 'projectId' is a required string.
      inputSchema: {
        type: "object",
        properties: {
          projectId: {
            type: "string",
            description: "The project ID to get articles from"
          }
        },
        required: ["projectId"]
      }
    },
  • Dispatch handler in the CallToolRequestHandler switch statement that validates input and delegates to the main getProjectArticles function.
    case "get_project_articles": {
      if (!args || typeof args !== 'object' || !('projectId' in args) || typeof args.projectId !== 'string') {
        throw new Error("projectId is required and must be a string");
      }
      return await this.getProjectArticles(args.projectId);
    }

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