get_role
Retrieve detailed security role information including permissions and settings by specifying a role ID within the Panther security monitoring platform.
Instructions
Get detailed information about a Panther role by ID
Returns complete role information including all permissions and settings.
Permissions:{'all_of': ['Read User Info']}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role_id | Yes | The ID of the role to fetch |
Implementation Reference
- The handler function for the 'get_role' MCP tool. It retrieves detailed role information from the Panther API by role ID, handles 404 not found cases, and returns success/error responses.async def get_role( role_id: Annotated[ str, Field( description="The ID of the role to fetch", examples=["Admin"], ), ], ) -> dict[str, Any]: """Get detailed information about a Panther role by ID Returns complete role information including all permissions and settings. """ logger.info(f"Fetching role details for role ID: {role_id}") try: async with get_rest_client() as client: # Allow 404 as a valid response to handle not found case result, status = await client.get( f"/roles/{role_id}", expected_codes=[200, 404] ) if status == 404: logger.warning(f"No role found with ID: {role_id}") return { "success": False, "message": f"No role found with ID: {role_id}", } logger.info(f"Successfully retrieved role details for role ID: {role_id}") return {"success": True, "role": result} except Exception as e: logger.error(f"Failed to get role details: {str(e)}") return { "success": False, "message": f"Failed to get role details: {str(e)}", }
- src/mcp_panther/panther_mcp_core/tools/roles.py:107-112 (registration)Registers the 'get_role' tool with the MCP registry using the @mcp_tool decorator, specifying required permissions and read-only hint.@mcp_tool( annotations={ "permissions": all_perms(Permission.USER_READ), "readOnlyHint": True, } )
- Pydantic schema definition for the 'role_id' input parameter using Annotated and Field for description and examples.role_id: Annotated[ str, Field( description="The ID of the role to fetch", examples=["Admin"], ), ],