get_blog_post_content
Retrieve complete content from any blog post URL by specifying the link, enabling direct access to detailed information for analysis or integration.
Instructions
Get the full content of a specific blog post by URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL of the blog post to retrieve content from |
Implementation Reference
- src/tools/blog-posts.ts:24-63 (handler)The MCP tool handler function for 'get_blog_post_content'. It processes the input URL, fetches blog post content using the helper, formats the result or error as MCP-standard content blocks, and returns it.async ({ url }) => { try { const result = await fetchBlogPostContent(url); return { content: [ { type: "text", text: JSON.stringify( { url: result.url, title: result.title, content: result.content, metadata: result.metadata, contentLength: result.contentLength, }, null, 2, ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: "Failed to retrieve blog post content", message: error instanceof Error ? error.message : "Unknown error", }, null, 2, ), }, ], isError: true, }; }
- src/tools/blog-posts.ts:6-22 (schema)Input schema using Zod for URL validation, along with tool title and description used in MCP tool registration.const urlSchema = z.string().url() as any; /** * Register the get blog post content tool */ export function registerGetBlogPostContentTool(server: McpServer) { server.registerTool( "get_blog_post_content", { title: "Get Blog Post Content", description: "Get the full content of a specific blog post by URL. Extracts article text, title, and metadata (author, publish date, tags) from blog.duyet.net or duyet.net posts.", inputSchema: { url: urlSchema.describe( "The URL of the blog post to retrieve content from (blog.duyet.net or duyet.net)", ), },
- src/tools/blog-posts.ts:11-66 (registration)The registerGetBlogPostContentTool function that calls server.registerTool to register the 'get_blog_post_content' tool with its schema and handler.export function registerGetBlogPostContentTool(server: McpServer) { server.registerTool( "get_blog_post_content", { title: "Get Blog Post Content", description: "Get the full content of a specific blog post by URL. Extracts article text, title, and metadata (author, publish date, tags) from blog.duyet.net or duyet.net posts.", inputSchema: { url: urlSchema.describe( "The URL of the blog post to retrieve content from (blog.duyet.net or duyet.net)", ), }, }, async ({ url }) => { try { const result = await fetchBlogPostContent(url); return { content: [ { type: "text", text: JSON.stringify( { url: result.url, title: result.title, content: result.content, metadata: result.metadata, contentLength: result.contentLength, }, null, 2, ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: "Failed to retrieve blog post content", message: error instanceof Error ? error.message : "Unknown error", }, null, 2, ), }, ], isError: true, }; } }, ); }
- src/tools/index.ts:29-30 (registration)The call to registerGetBlogPostContentTool within the main registerAllTools function, including logging confirmation.registerGetBlogPostContentTool(server); logger.tool("get_blog_post_content", "registered");
- src/core/blog.ts:316-335 (helper)Cached wrapper for fetching and parsing individual blog post content (title, article text, metadata) from blog.duyet.net/duyet.net URLs, used by the tool handler. Delegates to uncached internal implementation.export async function fetchBlogPostContent(url: string): Promise<{ url: string; title: string | null; content: string; metadata: { author?: string; publishDate?: string; tags?: string[]; }; contentLength: number; }> { // Use URL as cache key (normalized) const cacheKey = `blog-post-${encodeURIComponent(url)}`; return cacheOrFetch( cacheKey, CACHE_CONFIGS.BLOG, () => fetchBlogPostContentInternal(url), ); }