Skip to main content
Glama

update_article

Modify existing Dev.to articles by updating titles, markdown content, tags, or publish status using the article ID for targeted changes.

Instructions

Update an existing article on Dev.to Args: article_id: The ID of the article to update title: New title for the article (optional) body_markdown: New content in markdown format (optional) tags: New comma-separated list of tags (optional) published: Change publish status (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
article_idYes
body_markdownNo
publishedNo
tagsNo
titleNo

Implementation Reference

  • Implements the 'update_article' tool: fetches current article, prepares partial updates based on provided parameters, sends PUT request to Dev.to API, and returns success message with URL. Registered via @mcp.tool() decorator.
    @mcp.tool() async def update_article(article_id: int, title: str = None, body_markdown: str = None, tags: str = None, published: bool = None) -> str: """ Update an existing article on Dev.to Args: article_id: The ID of the article to update title: New title for the article (optional) body_markdown: New content in markdown format (optional) tags: New comma-separated list of tags (optional) published: Change publish status (optional) """ # First get the current article data article = await fetch_from_api(f"/articles/{article_id}") # Prepare update data with only the fields that are provided update_data = {"article": {}} if title is not None: update_data["article"]["title"] = title if body_markdown is not None: update_data["article"]["body_markdown"] = body_markdown if tags is not None: update_data["article"]["tags"] = tags if published is not None: update_data["article"]["published"] = published async with httpx.AsyncClient() as client: response = await client.put(f"{BASE_URL}/articles/{article_id}", json=update_data, timeout=10.0) response.raise_for_status() updated_article = response.json() return f"Article updated successfully\nURL: {updated_article.get('url')}"

Other Tools

Related Tools

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/Arindam200/devto-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server