Checking Tool Authorization Status
Before executing tools that require authorization, you can check their authorization status to understand what permissions are needed and whether they’re currently available for a user.
This is useful for:
- Displaying authorization requirements in your UI
- Pre-checking tool availability before execution
- Understanding which tools need user approval
- Debugging authorization issues
Initialize the client
Import the Arcade client in a Python/Javascript script.
from arcadepy import Arcade
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
Check authorization status for all tools
You can get a list of all available tools and check their authorization status for a specific user:
USER_ID = "you@example.com"
# Get all tools for the user
tools = client.tools.list(user_id=USER_ID)
for tool in tools:
print(f"Tool: {tool.name}")
if tool.requirements:
# Check if all requirements are met
print(f"Requirements met: {tool.requirements.met}")
# Check authorization status
if tool.requirements.authorization:
print(f"Authorization status: {tool.requirements.authorization.status}")
print(f"Token status: {tool.requirements.authorization.token_status}")
# Check secret requirements
if tool.requirements.secrets:
for secret in tool.requirements.secrets:
print(f"Secret '{secret.key}' met: {secret.met}")
if not secret.met and secret.status_reason:
print(f"Reason: {secret.status_reason}")
print("---")
If a username is not provided, the Token Status will be excluded and only the requirements for the provider will be shown.
Check authorization status for a specific tool
You can also check the authorization status for a specific tool by name:
USER_ID = "you@example.com"
TOOL_NAME = "Google.ListEmails"
# Get specific tool details
tool = client.tools.get(tool_name=TOOL_NAME, user_id=USER_ID)
print(f"Tool: {tool.name}")
print(f"Description: {tool.description}")
if tool.requirements:
print(f"All requirements met: {tool.requirements.met}")
if tool.requirements.authorization:
auth = tool.requirements.authorization
print(f"Authorization required: {auth.provider_type}")
print(f"Authorization status: {auth.status}")
print(f"Token status: {auth.token_status}")
if auth.status_reason:
print(f"Status reason: {auth.status_reason}")
if tool.requirements.secrets:
print("Secret requirements:")
for secret in tool.requirements.secrets:
status = "✓" if secret.met else "✗"
print(f" {status} {secret.key}")
Understanding the status values
Authorization Status
active
: If the provider is configured and enabledinactive
: Authorization is not found or is disabled
Token Status
not_started
: Authorization process hasn’t begunpending
: Authorization is in progress (user needs to approve)completed
: Authorization is complete and tokens are availablefailed
: Authorization process failed
Requirements Met
true
: All requirements for the tool are satisfiedfalse
: Some requirements are missing (authorization, secrets, etc.)
Secret Met
true
: The secret exists for the toolfalse
: The secret does not exist for the tool