get_joomla_articles
Retrieve all articles from a Joomla website to access and manage content directly through the MCP server.
Instructions
Retrieve all articles from the Joomla website.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_joomla_articles"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- main.py:59-78 (handler)The main handler function for the 'get_joomla_articles' tool. It is registered using the @mcp.tool decorator. This async function makes an authenticated GET request to the Joomla articles API endpoint and returns the JSON response if successful, or an error message otherwise.
@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:59-59 (registration)The @mcp.tool decorator registers the 'get_joomla_articles' function as an MCP tool with the specified description.
@mcp.tool(description="Retrieve all articles from the Joomla website.")