feati(api): add connectors API

Closes #4235 and #4061 (partially)

Signed-off-by: Jaideep Rao <jrao@redhat.com>
This commit is contained in:
Jaideep Rao 2025-11-28 21:34:00 +05:30
parent ee107aadd6
commit 565df6cc0a
11 changed files with 1515 additions and 135 deletions

View file

@ -427,6 +427,24 @@ resources:
cancel: post /v1/batches/{batch_id}/cancel
alpha:
subresources:
connectors:
models:
connector: Connector
list_connectors_response: ListConnectorsResponse
list_tools_response: ListToolsResponse
tool_def: ToolDef
methods:
list:
paginated: false
endpoint: get /v1alpha/connectors
retrieve: get /v1alpha/connectors/{connector_id}
subresources:
tools:
methods:
list:
paginated: false
endpoint: get /v1alpha/connectors/{connector_id}/tools
retrieve: get /v1alpha/connectors/{connector_id}/tools/{tool_name}
inference:
methods:
rerank: post /v1alpha/inference/rerank

View file

@ -3893,6 +3893,160 @@ paths:
schema:
$ref: '#/components/schemas/SupervisedFineTuneRequest'
required: true
/v1alpha/connectors/{connector_id}:
get:
responses:
'200':
description: A Connector.
content:
application/json:
schema:
$ref: '#/components/schemas/Connector'
'400':
$ref: '#/components/responses/BadRequest400'
description: Bad Request
'429':
$ref: '#/components/responses/TooManyRequests429'
description: Too Many Requests
'500':
$ref: '#/components/responses/InternalServerError500'
description: Internal Server Error
default:
$ref: '#/components/responses/DefaultError'
description: Default Response
tags:
- Connectors
summary: Get Connector
description: Get a connector by its ID.
operationId: get_connector_v1alpha_connectors__connector_id__get
parameters:
- name: include_tools
in: query
required: false
schema:
type: boolean
default: false
title: Include Tools
- name: connector_id
in: path
required: true
schema:
type: string
description: 'Path parameter: connector_id'
/v1alpha/connectors/{connector_id}/tools/{tool_name}:
get:
responses:
'200':
description: A ToolDef.
content:
application/json:
schema:
$ref: '#/components/schemas/ToolDef'
'400':
description: Bad Request
$ref: '#/components/responses/BadRequest400'
'429':
description: Too Many Requests
$ref: '#/components/responses/TooManyRequests429'
'500':
description: Internal Server Error
$ref: '#/components/responses/InternalServerError500'
default:
description: Default Response
$ref: '#/components/responses/DefaultError'
tags:
- Connectors
summary: Get Connector Tool
description: Get a tool definition by its name from a connector.
operationId: get_connector_tool_v1alpha_connectors__connector_id__tools__tool_name__get
parameters:
- name: connector_id
in: path
required: true
schema:
type: string
description: 'Path parameter: connector_id'
- name: tool_name
in: path
required: true
schema:
type: string
description: 'Path parameter: tool_name'
/v1alpha/connectors/{connector_id}/tools:
get:
responses:
'200':
description: A ListToolsResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/ListToolsResponse'
'400':
description: Bad Request
$ref: '#/components/responses/BadRequest400'
'429':
description: Too Many Requests
$ref: '#/components/responses/TooManyRequests429'
'500':
description: Internal Server Error
$ref: '#/components/responses/InternalServerError500'
default:
description: Default Response
$ref: '#/components/responses/DefaultError'
tags:
- Connectors
summary: List Connector Tools
description: List tools available from a connector.
operationId: list_connector_tools_v1alpha_connectors__connector_id__tools_get
parameters:
- name: connector_id
in: path
required: true
schema:
type: string
description: 'Path parameter: connector_id'
/v1alpha/connectors:
get:
responses:
'200':
description: A ListConnectorsResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/ListConnectorsResponse'
'400':
$ref: '#/components/responses/BadRequest400'
description: Bad Request
'429':
$ref: '#/components/responses/TooManyRequests429'
description: Too Many Requests
'500':
$ref: '#/components/responses/InternalServerError500'
description: Internal Server Error
default:
$ref: '#/components/responses/DefaultError'
description: Default Response
tags:
- Connectors
summary: List Connectors
description: List all configured connectors.
operationId: list_connectors_v1alpha_connectors_get
parameters:
- name: include_tools
in: query
required: false
schema:
type: boolean
default: false
title: Include Tools
- name: registry_id
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Registry Id
components:
schemas:
Error:
@ -11618,6 +11772,90 @@ components:
- chunk_id
title: Chunk
description: A chunk of content that can be inserted into a vector database.
Connector:
properties:
identifier:
type: string
title: Identifier
description: Unique identifier for this resource in llama stack
provider_resource_id:
anyOf:
- type: string
- type: 'null'
description: Unique identifier for this resource in the provider
provider_id:
type: string
title: Provider Id
description: ID of the provider that owns this resource
type:
type: string
const: connector
title: Type
default: connector
connector_type:
$ref: '#/components/schemas/ConnectorType'
default: mcp
connector_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the connector
url:
type: string
title: Url
description: URL of the connector
created_at:
type: string
format: date-time
title: Created At
description: Timestamp of creation
updated_at:
type: string
format: date-time
title: Updated At
description: Timestamp of last update
server_name:
anyOf:
- type: string
- type: 'null'
description: Name of the server
server_label:
anyOf:
- type: string
- type: 'null'
description: Label of the server
server_description:
anyOf:
- type: string
- type: 'null'
description: Description of the server
tools:
anyOf:
- items:
$ref: '#/components/schemas/ToolDef'
type: array
- type: 'null'
description: List of tools available from the connector
registry_id:
anyOf:
- type: string
- type: 'null'
description: ID of the registry this connector belongs to
type: object
required:
- identifier
- provider_id
- url
- created_at
- updated_at
title: Connector
description: A connector resource representing a connector registered in Llama Stack.
ConnectorType:
type: string
enum:
- mcp
title: ConnectorType
description: Type of connector.
ConversationItemInclude:
type: string
enum:
@ -11708,6 +11946,30 @@ components:
- cancelled
title: JobStatus
description: Status of a job execution.
ListConnectorsResponse:
properties:
data:
items:
$ref: '#/components/schemas/Connector'
type: array
title: Data
type: object
required:
- data
title: ListConnectorsResponse
description: Response containing a list of connectors.
ListToolsResponse:
properties:
data:
items:
$ref: '#/components/schemas/ToolDef'
type: array
title: Data
type: object
required:
- data
title: ListToolsResponse
description: Response containing a list of tools.
MCPListToolsTool:
properties:
input_schema:
@ -12573,6 +12835,66 @@ components:
type: string
title: DialogType
type: object
ToolGroupInput:
description: Input data for registering a tool group.
properties:
toolgroup_id:
title: Toolgroup Id
type: string
provider_id:
title: Provider Id
type: string
args:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
nullable: true
mcp_endpoint:
anyOf:
- $ref: '#/components/schemas/URL'
title: URL
- type: 'null'
nullable: true
title: URL
required:
- toolgroup_id
- provider_id
title: ToolGroupInput
type: object
ConnectorInput:
description: Input for creating a connector.
properties:
connector_type:
$ref: '#/components/schemas/ConnectorType'
default: mcp
connector_id:
anyOf:
- type: string
- type: 'null'
description: Unique identifier for the connector
nullable: true
url:
description: URL of the connector
title: Url
type: string
headers:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
description: HTTP headers to include when connecting
nullable: true
authorization:
anyOf:
- type: string
- type: 'null'
description: OAuth access token for authentication
nullable: true
required:
- url
title: ConnectorInput
type: object
ConversationMessage:
description: OpenAI-compatible message item for conversations.
properties:
@ -12657,33 +12979,6 @@ components:
- items
title: ConversationItemCreateRequest
type: object
ToolGroupInput:
description: Input data for registering a tool group.
properties:
toolgroup_id:
title: Toolgroup Id
type: string
provider_id:
title: Provider Id
type: string
args:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
nullable: true
mcp_endpoint:
anyOf:
- $ref: '#/components/schemas/URL'
title: URL
- type: 'null'
nullable: true
title: URL
required:
- toolgroup_id
- provider_id
title: ToolGroupInput
type: object
Api:
description: Enumeration of all available APIs in the Llama Stack system.
enum:
@ -12708,6 +13003,7 @@ components:
- files
- prompts
- conversations
- connectors
- inspect
title: Api
type: string