get_joomla_articles
Retrieve all articles from a Joomla website to access and manage published content through the Joomla MCP Server.
Instructions
Retrieve all articles from the Joomla website.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:59-78 (handler)The handler implementation for the 'get_joomla_articles' tool, including the @mcp.tool decorator for registration. Fetches all Joomla articles from the API endpoint using httpx with bearer token authentication, returning raw JSON or an error message.@mcp.tool(description="Retrieve all articles from the Joomla website.") async def get_joomla_articles() -> str: """Retrieve all articles from the Joomla website via its API.""" try: headers = { "Accept": "application/vnd.api+json", "User-Agent": "JoomlaArticlesMCP/1.0", "Authorization": f"Bearer {BEARER_TOKEN}", } async with httpx.AsyncClient() as client: response = await client.get(JOOMLA_ARTICLES_API_URL, headers=headers) if response.status_code == 200: return response.text else: return f"Failed to fetch articles: HTTP {response.status_code} - {response.text}" except httpx.HTTPError as e: return f"Error fetching articles: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"
- main.py:12-15 (helper)Helper constants defining the Joomla base URL, bearer token, and specific articles API endpoint used by the get_joomla_articles handler.JOOMLA_BASE_URL = os.getenv("JOOMLA_BASE_URL").rstrip("/") BEARER_TOKEN = os.getenv("BEARER_TOKEN") JOOMLA_ARTICLES_API_URL = f"{JOOMLA_BASE_URL}/api/index.php/v1/content/articles"