get_permissions
Diagnose permission errors and determine if a new API token is needed by retrieving the current user's permissions for security monitoring.
Instructions
Get the current user's permissions. Use this to diagnose permission errors and determine if a new API token is needed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The get_permissions tool handler: an async function decorated with @mcp_tool that fetches and converts the current user's permissions from the REST API, handling errors gracefully.@mcp_tool( annotations={ "readOnlyHint": True, } ) async def get_permissions() -> dict[str, Any]: """ Get the current user's permissions. Use this to diagnose permission errors and determine if a new API token is needed. """ logger.info("Getting permissions") try: async with get_rest_client() as client: result, _ = await client.get("/api-tokens/self") return { "success": True, "permissions": convert_permissions(result.get("permissions", [])), } except Exception as e: logger.error(f"Failed to fetch permissions: {str(e)}") return { "success": False, "message": f"Failed to fetch permissions: {str(e)}", }