- list - List available tools
- run - Execute the specified tool
- retrieve_action_pack_auth_status - Get end-user authentication status for an action pack.
- authorize_action_pack - Start the OAuth authorization flow for an action pack.
- retrieve_tool_server_auth_status - Get end-user authentication status for a tool server.
- authorize_tool_server - Start the OAuth authorization flow for a tool server.
Returns a filtered set of available tools based on optional tool name parameters. If no filters are provided, all available tools are returned.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.tools.list()
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
tool_names |
List[str] | ➖ | Optional array of tool names to filter by |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GleanError | 4XX, 5XX | */* |
Execute the specified tool with provided parameters
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.tools.run(name="<value>", parameters={
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
name |
str | ✔️ | Required name of the tool to execute |
parameters |
Dict[str, models.ToolsCallParameter] | ✔️ | The parameters for the tool. Each key is the name of the parameter and the value is the parameter object. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GleanError | 4XX, 5XX | */* |
Reports whether the calling user is already authenticated against the third-party tool backing the specified action pack. Intended for headless / server-driven clients that render an "Authorize" prompt when the user has not yet consented to the tool.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.tools.retrieve_action_pack_auth_status(action_pack_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
action_pack_id |
str | ✔️ | ID of the action pack to query or authorize. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.ActionPackAuthStatusResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GleanError | 4XX, 5XX | */* |
Starts the third-party OAuth flow for the specified action pack and returns the
redirect URL that the client should navigate the end user to. After the OAuth
callback completes, the user's browser is redirected back to returnUrl with a
status query parameter (?glean_action_auth=success|error&actionPackId=...).
returnUrl must match the tenant's configured return URL allowlist; otherwise the
request is rejected with 400.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.tools.authorize_action_pack(action_pack_id="<id>", return_url="https://merry-allocation.org/")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
action_pack_id |
str | ✔️ | ID of the action pack to query or authorize. |
return_url |
str | ✔️ | URL on the customer's domain to redirect the end user's browser back to after the third-party OAuth callback completes. Must be present in the tenant's return URL allowlist. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AuthorizeActionPackResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GleanError | 4XX, 5XX | */* |
Returns display information and the calling user's current authentication status for the specified tool server.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.tools.retrieve_tool_server_auth_status(server_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
server_id |
str | ✔️ | Unique identifier of the tool server. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.ToolServerAuthStatusResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GleanError | 4XX, 5XX | */* |
Initiates the third-party OAuth flow for the specified tool server and returns the
authorization URL that the client should navigate the end user to. After the OAuth
callback completes, the user's browser is redirected back to returnUrl with query
parameters indicating the result.
returnUrl must match the tenant's configured return URL allowlist; otherwise the
request is rejected with 400.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.tools.authorize_tool_server(server_id="<id>", return_url="https://lucky-disadvantage.com")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
server_id |
str | ✔️ | Unique identifier of the tool server. |
return_url |
str | ✔️ | URL to redirect the end user's browser back to after the OAuth flow completes. Must be present in the tenant's configured return URL allowlist. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AuthorizeToolServerResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.GleanError | 4XX, 5XX | */* |