Skip to main content
Glama

update_article

Modify existing Joomla articles by updating content, titles, metadata, or text formatting to keep website information current and accurate.

Instructions

Update an existing article on the Joomla website.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
article_idYes
titleNo
introtextNo
fulltextNo
metadescNo
convert_plain_textNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:317-411 (handler)
    The main handler function for the 'update_article' tool. It is decorated with @mcp.tool, which also serves as registration. The function fetches the existing article, prepares the update payload (handling title alias generation, text to HTML conversion), and sends a PATCH request to the Joomla API to update specified fields: title, introtext, fulltext, metadesc.
    @mcp.tool(description="Update an existing article on the Joomla website.")
    async def update_article(
        article_id: int,
        title: str = None,
        introtext: str = None,
        fulltext: str = None,
        metadesc: str = None,
        convert_plain_text: bool = True,
    ) -> str:
        """
        Update an existing article on the Joomla website via its API. Allows updating the title, introtext, fulltext,
        and meta description. Provide both introtext and fulltext together for articles with separate introductory
        and main content, or provide only fulltext for articles where a single body of content is sufficient.
        Introtext alone is not sufficient and will be ignored unless accompanied by fulltext.
        Before updating, confirm the article's title and ID are correct.
        Only articles with both introtext and fulltext will be updated.
    
        Args:
            article_id(int): The ID of the article to update. Don't prompt user for article_id, infer it by running the get_joomla_articles tool.
            title (str, optional): New title for the article.
            introtext (str, optional): Introductory text (requires fulltext if provided).
            fulltext: Optional full content for the article (plain text or HTML). Used as primary content if provided alone,
            or as main content if provided with introtext.
            metadesc: Optional meta description for the article.
            convert_plain_text: Whether to auto-convert plain text to HTML for introtext and fulltext (default: True).
    
        Returns:
            Result string indicating success or failure.
        """
        try:
            if not isinstance(article_id, int):
                return "Error: Article ID must be an integer."
            if not any([title, introtext, fulltext, metadesc]):
                return "Error: At least one of title, introtext, fulltext, or metadesc must be provided."
            headers = {
                "Accept": "application/vnd.api+json",
                "Content-Type": "application/json",
                "User-Agent": "JoomlaArticlesMCP/1.0",
                "Authorization": f"Bearer {BEARER_TOKEN}",
            }
            async with httpx.AsyncClient() as client:
                response = await client.get(
                    f"{JOOMLA_ARTICLES_API_URL}/{article_id}", headers=headers
                )
            if response.status_code != 200:
                return (
                    f"Failed to find article: HTTP {response.status_code} - {response.text}"
                )
            try:
                data = json.loads(response.text)
                article_data = data.get("data", {}).get("attributes", {})
                current_title = article_data.get("title", "Unknown")
            except json.JSONDecodeError:
                return f"Failed to parse article data: Invalid JSON - {response.text}"
            payload = {}
            if title:
                payload["title"] = title
                payload["alias"] = generate_alias(title)
            if metadesc:
                payload["metadesc"] = metadesc
            if introtext:
                payload["introtext"] = (
                    convert_text_to_html(introtext) if convert_plain_text else introtext
                )
                if fulltext:
                    payload["fulltext"] = (
                        convert_text_to_html(fulltext) if convert_plain_text else fulltext
                    )
            elif fulltext:
                payload["articletext"] = (
                    convert_text_to_html(fulltext) if convert_plain_text else fulltext
                )
            async with httpx.AsyncClient() as client:
                response = await client.patch(
                    f"{JOOMLA_ARTICLES_API_URL}/{article_id}", json=payload, headers=headers
                )
            if response.status_code in (200, 204):
                updated_fields = []
                if title:
                    updated_fields.append(f"title to '{title}'")
                if introtext:
                    updated_fields.append("introtext")
                if fulltext:
                    updated_fields.append("fulltext" if introtext else "body")
                if metadesc:
                    updated_fields.append("metadesc")
                return f"Successfully updated article '{current_title}' (ID: {article_id}) {', '.join(updated_fields)}."
            else:
                error_detail = response.text
                return f"Failed to update article: HTTP {response.status_code} - {error_detail}. This may indicate a server-side issue or insufficient permissions. Please verify the bearer token permissions and Joomla server logs."
        except httpx.HTTPError as e:
            return f"Error updating article: {str(e)}. Please check network connectivity or Joomla API availability."
        except Exception as e:
            return f"Unexpected error: {str(e)}. Please try again or contact support."
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it's an update operation without disclosing behavioral traits. It doesn't mention authentication needs, rate limits, whether changes are reversible, what happens to unspecified fields, or the response format. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core purpose, making it efficient and easy to parse, though this conciseness comes at the cost of detail in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, mutation operation, no annotations) and the presence of an output schema, the description is incomplete. It doesn't compensate for the lack of annotations or low schema coverage, failing to provide necessary context for safe and effective use, despite the output schema potentially covering return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no meaning beyond what the input schema provides. With 0% schema description coverage and 6 parameters (including complex ones like 'introtext' and 'convert_plain_text'), the description fails to explain what these parameters do, their formats, or how they affect the update. This leaves parameters largely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('an existing article on the Joomla website'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its sibling 'manage_article_state' which might also modify articles, nor does it specify what aspects of an article can be updated beyond the general concept.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'manage_article_state' for state changes or 'create_article' for new articles. It mentions 'existing article' which implies a prerequisite of article existence but doesn't explicitly state this or reference sibling tools for checking or creating articles.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/nasoma/joomla-mcp-server'

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