Files
mcphub/plugins/openpanel/handlers/utils.py
airano cf62e65c55 Initial commit: MCP Hub Community Edition v3.0.0
Community edition generated from private repo via sync pipeline.
Includes 9 plugins (WordPress, WooCommerce, WP Advanced, Gitea, n8n,
Supabase, OpenPanel, Appwrite, Directus) with ~587 tools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 08:34:44 +03:30

28 lines
885 B
Python

"""Utility functions for OpenPanel handlers"""
from plugins.openpanel.client import OpenPanelClient
def get_project_id(client: OpenPanelClient, project_id: str | None) -> str:
"""
Get effective project_id, using default if not provided.
Args:
client: OpenPanel client with potential default_project_id
project_id: Explicitly provided project_id (may be None)
Returns:
Effective project_id to use
Raises:
ValueError: If no project_id available
"""
if project_id:
return project_id
if client.default_project_id:
return client.default_project_id
raise ValueError(
"project_id is required. Either provide it as a parameter or configure "
"OPENPANEL_SITE1_PROJECT_ID in environment variables. "
"You can find your Project ID in OpenPanel Dashboard → Project Settings."
)