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
| 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 `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"] } },
- src/index.ts:206-216 (schema)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"] } },
- src/index.ts:295-300 (handler)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); }