Skip to main content

Connector

Use Alibaba Cloud Model Studio CLI to discover connector tools, inspect their inputs, and run them on an authorized connector instance.

Call authorized Connector tools in a workspace from the CLI to query enterprise system data, read SaaS application content, or run authorized operations.
Append --help to any command for full parameter details, for example bl connector tools --help. Command details on this page are verified against bl 2.15.0.
Connect apps and authorize accounts in the console. For concepts and authorization, see Connector.

Prerequisites

  • An API Key that belongs to the target workspace. For authentication, see Installation and authentication.
  • For bl connector schema and bl connector call, at least one app connected and its account authorized in the console. bl connector tools can find matching tools before authorization and reports the authorization status.
  • Connector commands use a workspace-specific endpoint. Provide the workspace ID with --workspace-id <id>, the BAILIAN_WORKSPACE_ID environment variable, or the workspace_id configuration item.

Workflow

  1. Describe the task to find matching tools and authorized instances.
  2. Inspect the input schema of the selected tool.
  3. Pass a JSON object that matches the schema to run the tool.

1. Find tools and instances

bl connector tools --query "Find tomorrow's meetings"
  • --query describes the task and can name a preferred app or account.
  • Use the tool reference (toolRef), instance ID (recommendedInstanceId or an ID from instances), and traceId from the result in the following commands.
  • A task can return multiple tools or instances. Pick the one that matches the task.

2. Inspect the tool input schema

bl connector schema --tool <toolRef> --instance <instanceId> --trace-id <traceId> --output json
  • --tool: the tool reference returned by bl connector tools.
  • --instance: the ID of the authorized connector instance.
  • --trace-id: optional. Reuse the trace ID from discovery to keep the call chain together.
  • Build the --json object for the next step from the returned schema.

3. Run the tool

bl connector call --tool <toolRef> --instance <instanceId> --json '{"key":"value"}' --trace-id <traceId> --dry-run
  • --json must be a JSON object that matches the tool input schema.
  • --dry-run only previews the request and does not validate the arguments against the tool schema. Remove it to validate and run the tool.
  • Running a tool reads or writes data in the authorized system. Verify the tool, instance, and arguments first.

Command reference

All commands accept --workspace-id <id> or the BAILIAN_WORKSPACE_ID environment variable. The tables below omit shared parameters such as --api-key, --output, and --dry-run.

bl connector tools

Discover connector tools and authorized instances by intent. Requires API Key authentication. Usage
bl connector tools --query <text> [flags]
ParameterTypeRequiredDescription
--query <text>stringyesDescribe the task and any preferred app or account
Example
bl connector tools --query "Find tomorrow's meetings"
  • Returns matching tools and authorized instances in the workspace. When instances is empty and authorizationRequired is true, authorize the app in the console first.
  • Use the tool reference (toolRef), instance ID (recommendedInstanceId or an ID from instances), and traceId from the result in schema and call.

bl connector schema

Inspect the input schema of a connector tool for the selected instance. Requires API Key authentication. Usage
bl connector schema --tool <toolRef> --instance <instanceId> [flags]
ParameterTypeRequiredDescription
--tool <toolRef>stringyesTool reference returned by discovery
--instance <instanceId>stringyesSelected authorized connector instance
--trace-id <id>stringnoTrace ID from connector discovery
Example: Inspect the input schema as JSON
bl connector schema --tool <toolRef> --instance <instanceId> --output json

bl connector call

Validate arguments and run one connector tool on the selected instance. Requires API Key authentication. Usage
bl connector call --tool <toolRef> --instance <instanceId> --json '<object>' [flags]
ParameterTypeRequiredDescription
--tool <toolRef>stringyesTool reference returned by discovery
--instance <instanceId>stringyesSelected authorized connector instance
--json <object>stringyesJSON object matching the selected tool schema
--trace-id <id>stringnoTrace ID from connector discovery
Example: Preview the request without running the tool
bl connector call --tool <toolRef> --instance <instanceId> --json '{}' --dry-run
  • --dry-run only previews the request and does not validate the arguments against the tool schema.
  • Without --dry-run, invalid arguments fail before the execution request is sent.
  • Running a tool reads or writes data in the authorized system.
  • Use --output json for structured results that scripts or agents can parse.