Gleanex.Client.Tools (Gleanex v0.1.0)

Copy Markdown View Source

Provides API endpoints related to tools

Summary

Functions

Start the OAuth authorization flow for an action pack.

Start the OAuth authorization flow for a tool server.

Get end-user authentication status for an action pack.

Get end-user authentication status for a tool server.

Get tool definitions from a tool server.

Execute the specified tool

List available tools

Functions

authorize_action_pack(actionPackId, body, opts \\ [])

@spec authorize_action_pack(
  actionPackId :: String.t(),
  body :: Gleanex.Client.AuthorizeActionPackRequest.t(),
  opts :: keyword()
) ::
  {:ok, Gleanex.Client.AuthorizeActionPackResponse.t()}
  | {:error, Gleanex.Error.t()}

Start the OAuth authorization flow for an action pack.

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.

Request Body

Content Types: application/json

authorize_tool_server(serverId, body, opts \\ [])

@spec authorize_tool_server(
  serverId :: String.t(),
  body :: Gleanex.Client.AuthorizeToolServerRequest.t(),
  opts :: keyword()
) ::
  {:ok, Gleanex.Client.AuthorizeToolServerResponse.t()}
  | {:error, Gleanex.Error.t()}

Start the OAuth authorization flow for a tool server.

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.

Request Body

Content Types: application/json

get_action_pack_auth_status(actionPackId, opts \\ [])

@spec get_action_pack_auth_status(actionPackId :: String.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.ActionPackAuthStatusResponse.t()}
  | {:error, Gleanex.Error.t()}

Get end-user authentication status for an action pack.

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.

get_tool_server_auth_status(serverId, opts \\ [])

@spec get_tool_server_auth_status(serverId :: String.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.ToolServerAuthStatusResponse.t()}
  | {:error, Gleanex.Error.t()}

Get end-user authentication status for a tool server.

Returns display information and the calling user's current authentication status for the specified tool server.

get_tool_server_tools(serverId, opts \\ [])

@spec get_tool_server_tools(serverId :: String.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.ToolDefinitionsResponse.t()}
  | {:error, Gleanex.Error.t()}

Get tool definitions from a tool server.

Returns the name, description and JSON input schema for the named tools on the specified tool server. Works for both action packs and MCP servers.

toolNames is required. Names that do not exist on the server are returned in notFound rather than failing the request, so a single bad name does not force callers into one-at-a-time retries. Matching is case-insensitive and treats - and _ as equivalent.

Native tools are not served; serverId=native returns 404.

Options

  • toolNames: Tool names to look up on this server. Maximum 100.

tools_call(body, opts \\ [])

@spec tools_call(body :: Gleanex.Client.ToolsCallRequest.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.ToolsCallResponse.t()} | {:error, Gleanex.Error.t()}

Execute the specified tool

Execute the specified tool with provided parameters

Request Body

Content Types: application/json

tools_list_get(opts \\ [])

@spec tools_list_get(opts :: keyword()) ::
  {:ok, Gleanex.Client.ToolsListResponse.t()} | {:error, Gleanex.Error.t()}

List available tools

Returns a filtered set of available tools based on optional tool name parameters. If no filters are provided, all available tools are returned.

Options

  • toolNames: Optional array of tool names to filter by