get_article_details
Retrieve comprehensive details about a specific Dev.to article by providing its unique article ID. Useful for accessing article content, metadata, and related information.
Instructions
Get detailed information about a specific article
Args:
article_id: The ID of the article to retrieve
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| article_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"article_id": {
"title": "Article Id",
"type": "integer"
}
},
"required": [
"article_id"
],
"title": "get_article_detailsArguments",
"type": "object"
}
Implementation Reference
- server.py:67-67 (registration)The @mcp.tool() decorator registers the get_article_details function as an MCP tool in the FastMCP server.@mcp.tool()
- server.py:68-76 (handler)The handler function implementing the core logic of the get_article_details tool. It fetches the article from the Dev.to API endpoint /articles/{article_id} and formats the response using the format_article_details helper.async def get_article_details(article_id: int) -> str: """ Get detailed information about a specific article Args: article_id: The ID of the article to retrieve """ article = await fetch_from_api(f"/articles/{article_id}") return format_article_details(article)
- server.py:190-208 (helper)Helper function called by get_article_details to format and return the detailed article information in a readable markdown string.def format_article_details(article: dict) -> str: """Format a single article with full details""" if not article: return "Article not found." title = article.get("title", "Untitled") author = article.get("user", {}).get("name", "Unknown Author") published_date = article.get("readable_publish_date", "Unknown date") body = article.get("body_markdown", "No content available.") tags = article.get("tags", "") result = f"# {title}\n\n" result += f"Author: {author}\n" result += f"Published: {published_date}\n" result += f"Tags: {tags}\n\n" result += "## Content\n\n" result += body return result
- server.py:12-18 (helper)Generic helper function used by get_article_details (and other tools) to perform HTTP GET requests to the Dev.to API and return JSON data.async def fetch_from_api(path: str, params: dict = None) -> dict: """Helper function to fetch data from Dev.to API""" async with httpx.AsyncClient() as client: url = f"{BASE_URL}{path}" response = await client.get(url, params=params, timeout=10.0) response.raise_for_status() return response.json()