Skip to content

Latest commit

 

History

History
117 lines (81 loc) · 4.47 KB

File metadata and controls

117 lines (81 loc) · 4.47 KB

Client.Tools

Overview

Available Operations

  • list - List available tools
  • run - Execute the specified tool

list

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

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.operations.GetRestApiV1ToolsListResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        GetRestApiV1ToolsListResponse res = sdk.client().tools().list()
                .call();

        if (res.toolsListResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
toolNames List<String> Optional array of tool names to filter by

Response

GetRestApiV1ToolsListResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

run

Execute the specified tool with provided parameters

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.ToolsCallParameter;
import com.glean.api_client.glean_api_client.models.components.ToolsCallRequest;
import com.glean.api_client.glean_api_client.models.operations.PostRestApiV1ToolsCallResponse;
import java.lang.Exception;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        ToolsCallRequest req = ToolsCallRequest.builder()
                .name("<value>")
                .parameters(Map.ofEntries(
                    Map.entry("key", ToolsCallParameter.builder()
                        .name("<value>")
                        .value("<value>")
                        .build())))
                .build();

        PostRestApiV1ToolsCallResponse res = sdk.client().tools().run()
                .request(req)
                .call();

        if (res.toolsCallResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request ToolsCallRequest ✔️ The request object to use for the request.

Response

PostRestApiV1ToolsCallResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*