Skip to main content
Glama

manage_article_state

Change the publication status of Joomla articles to published, unpublished, archived, or trashed states using article ID and target state parameters.

Instructions

Manage the state of an existing article on the Joomla website (published, unpublished, archived, trashed)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
article_idYes
target_stateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:201-203 (registration)
    The @mcp.tool decorator that registers the manage_article_state function as an MCP tool.
    @mcp.tool(
        description="Manage the state of an existing article on the Joomla website (published, unpublished, archived, trashed)"
    )
  • main.py:204-258 (handler)
    The core handler function that implements the logic for managing Joomla article states via API: fetches current state, validates target state, and performs PATCH update if needed.
    async def manage_article_state(article_id: int, target_state: int) -> str:
        """
        Manage the state of an existing article on the Joomla website via its API. Updates the article to the
        user-specified state (published=1, unpublished=0, archived=2, trashed=-2) if it differs from the current state.
    
        Args:
            article_id(int): The ID of the existing article to check and update.
            target_state: The desired state for the article (1=published, 0=unpublished, 2=archived, -2=trashed).
    
        Returns:
            Success message with article title, ID, and state change, or an error message if the request fails.
        """
        try:
            if not isinstance(article_id, int):
                return "Error: Article ID must be an integer."
            valid_states = {1, 0, 2, -2}
            if target_state not in valid_states:
                return f"Error: Invalid target state {target_state}. Valid states are 1 (published), 0 (unpublished), 2 (archived), -2 (trashed)."
            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 fetch article: HTTP {response.status_code} - {response.text}"
            try:
                data = json.loads(response.text)
                article_data = data.get("data", {}).get("attributes", {})
                current_state = article_data.get("state", 0)
                title = article_data.get("title", "Unknown")
            except json.JSONDecodeError:
                return f"Failed to parse article data: Invalid JSON - {response.text}"
            state_map = {1: "published", 0: "unpublished", 2: "archived", -2: "trashed"}
            current_state_name = state_map.get(current_state, "unknown")
            target_state_name = state_map.get(target_state, "unknown")
            if current_state == target_state:
                return f"Article '{title}' (ID: {article_id}) is already in {current_state_name} state."
            payload = {"state": target_state}
            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):
                return f"Successfully updated article '{title}' (ID: {article_id}) from {current_state_name} to {target_state_name} state."
            else:
                return f"Failed to update article state: HTTP {response.status_code} - {response.text}"
        except httpx.HTTPError as e:
            return f"Error updating article state: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Helper usage of manage_article_state within the move_article_to_trash tool to set state to trashed (-2).
    return await manage_article_state(article_id, -2)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It implies a mutation operation ('manage the state') but doesn't disclose behavioral traits such as required permissions, whether changes are reversible, rate limits, or what happens to the article in each state. The description is minimal and lacks critical context for safe usage.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the purpose. It avoids unnecessary words, though it could be more structured (e.g., separating usage notes). Every part earns its place by specifying the action and states.

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

Completeness3/5

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

Given the complexity (state mutation tool), no annotations, and an output schema (which reduces need to explain returns), the description is incomplete. It covers the basic purpose but lacks usage guidelines, parameter details, and behavioral transparency, making it minimally adequate but with clear gaps for a mutation tool.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'target_state' with examples (published, unpublished, archived, trashed) but doesn't explain the mapping to integer values or provide details on 'article_id' (e.g., format, sourcing). This adds some meaning but is insufficient for the two undocumented parameters.

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 verb ('manage') and resource ('existing article on the Joomla website') with specific states listed (published, unpublished, archived, trashed). It distinguishes from siblings like 'create_article' (creation vs. state management) and 'move_article_to_trash' (specific state vs. general management), though it doesn't explicitly name alternatives.

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 'move_article_to_trash' or 'update_article'. It mentions managing states but doesn't clarify prerequisites (e.g., article must exist) or exclusions (e.g., not for new 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