get_project_articles
Retrieve all articles associated with a specific project by providing its unique project ID. Ideal for managing and organizing content within the Semantic Pen MCP Server for enhanced article generation and optimization.
Instructions
Get all articles from a specific project by project ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | The project ID to get articles from |
Implementation Reference
- src/index.ts:395-438 (handler)The primary handler function that retrieves articles for a specific project by making an API request to `/article-queue/${projectId}`, processes the articles (including word count calculation), and returns a formatted text response with article details.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 ListTools response, defining the tool name, description, and input schema requiring 'projectId'.{ 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"] } },
- src/index.ts:295-300 (registration)Dispatch handler in the CallToolRequestSchema switch statement that validates input and calls the getProjectArticles method.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); }
- src/index.ts:206-214 (schema)Input schema definition for the tool, specifying projectId as a required string.inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The project ID to get articles from" } }, required: ["projectId"]