This commit is contained in:
Jaideep Rao 2025-12-03 01:04:11 +00:00 committed by GitHub
commit 214e296e62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 2550 additions and 153 deletions

View file

@ -3893,6 +3893,219 @@ 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/registries/{registry_id}:
get:
responses:
'200':
description: A Registry.
content:
application/json:
schema:
$ref: '#/components/schemas/Registry'
'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 Registry
description: Get a registry by its ID.
operationId: get_registry_v1alpha_connectors_registries__registry_id__get
parameters:
- name: registry_id
in: path
required: true
schema:
type: string
description: 'Path parameter: registry_id'
/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
/v1alpha/connectors/registries:
get:
responses:
'200':
description: A ListRegistriesResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/ListRegistriesResponse'
'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 Registries
description: List all registries.
operationId: list_registries_v1alpha_connectors_registries_get
components:
schemas:
Error:
@ -7045,8 +7258,13 @@ components:
type: string
title: Server Label
server_url:
type: string
title: Server Url
anyOf:
- type: string
- type: 'null'
connector_id:
anyOf:
- type: string
- type: 'null'
headers:
anyOf:
- additionalProperties: true
@ -7079,7 +7297,6 @@ components:
type: object
required:
- server_label
- server_url
title: OpenAIResponseInputToolMCP
description: Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
CreateOpenaiResponseRequest:
@ -11618,6 +11835,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 +12009,42 @@ 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.
ListRegistriesResponse:
properties:
data:
items:
$ref: '#/components/schemas/Registry'
type: array
title: Data
type: object
required:
- data
title: ListRegistriesResponse
description: Response containing a list of registries.
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:
@ -12100,6 +12437,63 @@ components:
required:
- reasoning_tokens
title: OutputTokensDetails
Registry:
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: registry
title: Type
default: registry
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
url:
type: string
title: Url
description: URL of the registry
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
type: object
required:
- identifier
- provider_id
- url
- created_at
- updated_at
title: Registry
description: A registry resource representing a registry of connectors.
RegistryType:
type: string
enum:
- mcp
title: RegistryType
description: Type of registry.
SearchRankingOptions:
properties:
ranker:
@ -12573,6 +12967,85 @@ components:
type: string
title: DialogType
type: object
RegistryInput:
description: Input for creating a registry.
properties:
url:
title: Url
type: string
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
nullable: true
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
required:
- url
title: RegistryInput
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 +13130,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 +13154,7 @@ components:
- files
- prompts
- conversations
- connectors
- inspect
title: Api
type: string

View file

@ -4039,8 +4039,13 @@ components:
type: string
title: Server Label
server_url:
type: string
title: Server Url
anyOf:
- type: string
- type: 'null'
connector_id:
anyOf:
- type: string
- type: 'null'
headers:
anyOf:
- additionalProperties: true
@ -4073,7 +4078,6 @@ components:
type: object
required:
- server_label
- server_url
title: OpenAIResponseInputToolMCP
description: Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
CreateOpenaiResponseRequest:
@ -8612,6 +8616,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:
@ -8702,6 +8790,42 @@ 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.
ListRegistriesResponse:
properties:
data:
items:
$ref: '#/components/schemas/Registry'
type: array
title: Data
type: object
required:
- data
title: ListRegistriesResponse
description: Response containing a list of registries.
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:
@ -9094,6 +9218,63 @@ components:
required:
- reasoning_tokens
title: OutputTokensDetails
Registry:
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: registry
title: Type
default: registry
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
url:
type: string
title: Url
description: URL of the registry
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
type: object
required:
- identifier
- provider_id
- url
- created_at
- updated_at
title: Registry
description: A registry resource representing a registry of connectors.
RegistryType:
type: string
enum:
- mcp
title: RegistryType
description: Type of registry.
SearchRankingOptions:
properties:
ranker:
@ -9567,6 +9748,85 @@ components:
type: string
title: DialogType
type: object
RegistryInput:
description: Input for creating a registry.
properties:
url:
title: Url
type: string
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
nullable: true
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
required:
- url
title: RegistryInput
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:
@ -9651,33 +9911,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:
@ -9702,6 +9935,7 @@ components:
- files
- prompts
- conversations
- connectors
- inspect
title: Api
type: string

View file

@ -630,6 +630,219 @@ 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/registries/{registry_id}:
get:
responses:
'200':
description: A Registry.
content:
application/json:
schema:
$ref: '#/components/schemas/Registry'
'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 Registry
description: Get a registry by its ID.
operationId: get_registry_v1alpha_connectors_registries__registry_id__get
parameters:
- name: registry_id
in: path
required: true
schema:
type: string
description: 'Path parameter: registry_id'
/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
/v1alpha/connectors/registries:
get:
responses:
'200':
description: A ListRegistriesResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/ListRegistriesResponse'
'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 Registries
description: List all registries.
operationId: list_registries_v1alpha_connectors_registries_get
components:
schemas:
Error:
@ -3579,8 +3792,13 @@ components:
type: string
title: Server Label
server_url:
type: string
title: Server Url
anyOf:
- type: string
- type: 'null'
connector_id:
anyOf:
- type: string
- type: 'null'
headers:
anyOf:
- additionalProperties: true
@ -3613,7 +3831,6 @@ components:
type: object
required:
- server_label
- server_url
title: OpenAIResponseInputToolMCP
description: Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
OpenAIResponseObject:
@ -7459,6 +7676,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.
DatasetPurpose:
type: string
enum:
@ -7537,6 +7838,42 @@ 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.
ListRegistriesResponse:
properties:
data:
items:
$ref: '#/components/schemas/Registry'
type: array
title: Data
type: object
required:
- data
title: ListRegistriesResponse
description: Response containing a list of registries.
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:
@ -7860,6 +8197,63 @@ components:
required:
- reasoning_tokens
title: OutputTokensDetails
Registry:
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: registry
title: Type
default: registry
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
url:
type: string
title: Url
description: URL of the registry
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
type: object
required:
- identifier
- provider_id
- url
- created_at
- updated_at
title: Registry
description: A registry resource representing a registry of connectors.
RegistryType:
type: string
enum:
- mcp
title: RegistryType
description: Type of registry.
SearchRankingOptions:
properties:
ranker:
@ -8333,6 +8727,85 @@ components:
type: string
title: DialogType
type: object
RegistryInput:
description: Input for creating a registry.
properties:
url:
title: Url
type: string
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
nullable: true
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
required:
- url
title: RegistryInput
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:
@ -8417,33 +8890,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:
@ -8468,6 +8914,7 @@ components:
- files
- prompts
- conversations
- connectors
- inspect
title: Api
type: string

View file

@ -5850,8 +5850,13 @@ components:
type: string
title: Server Label
server_url:
type: string
title: Server Url
anyOf:
- type: string
- type: 'null'
connector_id:
anyOf:
- type: string
- type: 'null'
headers:
anyOf:
- additionalProperties: true
@ -5884,7 +5889,6 @@ components:
type: object
required:
- server_label
- server_url
title: OpenAIResponseInputToolMCP
description: Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
CreateOpenaiResponseRequest:
@ -10054,6 +10058,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:
@ -10144,6 +10232,42 @@ 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.
ListRegistriesResponse:
properties:
data:
items:
$ref: '#/components/schemas/Registry'
type: array
title: Data
type: object
required:
- data
title: ListRegistriesResponse
description: Response containing a list of registries.
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:
@ -10536,6 +10660,63 @@ components:
required:
- reasoning_tokens
title: OutputTokensDetails
Registry:
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: registry
title: Type
default: registry
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
url:
type: string
title: Url
description: URL of the registry
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
type: object
required:
- identifier
- provider_id
- url
- created_at
- updated_at
title: Registry
description: A registry resource representing a registry of connectors.
RegistryType:
type: string
enum:
- mcp
title: RegistryType
description: Type of registry.
SearchRankingOptions:
properties:
ranker:
@ -11009,6 +11190,85 @@ components:
type: string
title: DialogType
type: object
RegistryInput:
description: Input for creating a registry.
properties:
url:
title: Url
type: string
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
nullable: true
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
required:
- url
title: RegistryInput
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:
@ -11093,33 +11353,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:
@ -11144,6 +11377,7 @@ components:
- files
- prompts
- conversations
- connectors
- inspect
title: Api
type: string

View file

@ -3893,6 +3893,219 @@ 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/registries/{registry_id}:
get:
responses:
'200':
description: A Registry.
content:
application/json:
schema:
$ref: '#/components/schemas/Registry'
'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 Registry
description: Get a registry by its ID.
operationId: get_registry_v1alpha_connectors_registries__registry_id__get
parameters:
- name: registry_id
in: path
required: true
schema:
type: string
description: 'Path parameter: registry_id'
/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
/v1alpha/connectors/registries:
get:
responses:
'200':
description: A ListRegistriesResponse.
content:
application/json:
schema:
$ref: '#/components/schemas/ListRegistriesResponse'
'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 Registries
description: List all registries.
operationId: list_registries_v1alpha_connectors_registries_get
components:
schemas:
Error:
@ -7045,8 +7258,13 @@ components:
type: string
title: Server Label
server_url:
type: string
title: Server Url
anyOf:
- type: string
- type: 'null'
connector_id:
anyOf:
- type: string
- type: 'null'
headers:
anyOf:
- additionalProperties: true
@ -7079,7 +7297,6 @@ components:
type: object
required:
- server_label
- server_url
title: OpenAIResponseInputToolMCP
description: Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
CreateOpenaiResponseRequest:
@ -11618,6 +11835,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 +12009,42 @@ 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.
ListRegistriesResponse:
properties:
data:
items:
$ref: '#/components/schemas/Registry'
type: array
title: Data
type: object
required:
- data
title: ListRegistriesResponse
description: Response containing a list of registries.
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:
@ -12100,6 +12437,63 @@ components:
required:
- reasoning_tokens
title: OutputTokensDetails
Registry:
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: registry
title: Type
default: registry
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
url:
type: string
title: Url
description: URL of the registry
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
type: object
required:
- identifier
- provider_id
- url
- created_at
- updated_at
title: Registry
description: A registry resource representing a registry of connectors.
RegistryType:
type: string
enum:
- mcp
title: RegistryType
description: Type of registry.
SearchRankingOptions:
properties:
ranker:
@ -12573,6 +12967,85 @@ components:
type: string
title: DialogType
type: object
RegistryInput:
description: Input for creating a registry.
properties:
url:
title: Url
type: string
user_registry_id:
anyOf:
- type: string
- type: 'null'
description: User-specified identifier for the registry
nullable: true
registry_type:
$ref: '#/components/schemas/RegistryType'
default: mcp
required:
- url
title: RegistryInput
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 +13130,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 +13154,7 @@ components:
- files
- prompts
- conversations
- connectors
- inspect
title: Api
type: string

View file

@ -0,0 +1,5 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

View file

@ -0,0 +1,184 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from datetime import UTC, datetime
from typing import Any
from pydantic import BaseModel
from llama_stack.core.datatypes import StackRunConfig
from llama_stack.log import get_logger
from llama_stack.providers.utils.tools.mcp import get_mcp_server_info, list_mcp_tools
from llama_stack_api import (
Connector,
ConnectorNotFoundError,
Connectors,
ConnectorToolNotFoundError,
ConnectorType,
ListConnectorsResponse,
ListRegistriesResponse,
ListToolsResponse,
Registry,
RegistryNotFoundError,
ToolDef,
)
logger = get_logger(name=__name__, category="connectors")
class ConnectorServiceConfig(BaseModel):
"""Configuration for the built-in connector service.
:param run_config: Stack run configuration for resolving persistence
"""
run_config: StackRunConfig
async def get_provider_impl(config: ConnectorServiceConfig):
"""Get the connector service implementation."""
impl = ConnectorServiceImpl(config)
return impl
class ConnectorServiceImpl(Connectors):
"""Built-in connector service implementation."""
def __init__(self, config: ConnectorServiceConfig):
self.config = config
# TODO: should these be stored in a kvstore?
self.connectors_map: dict[str, Connector] = {}
self.registries_map: dict[str, Registry] = {}
def get_connector_url(self, connector_id: str) -> str | None:
"""Get the URL of a connector by its ID.
:param connector_id: The ID of the connector to get the URL for.
:returns: The URL of the connector.
"""
connector = self.connectors_map.get(connector_id)
if connector is None:
return None
return connector.url
async def register_connector(
self,
url: str,
connector_id: str | None = None,
connector_type: ConnectorType = ConnectorType.MCP,
headers: dict[str, Any] | None = None,
authorization: str | None = None,
) -> Connector:
"""Register a new connector.
:param url: URL of the MCP server to connect to.
:param connector_id: (Optional) User-specified identifier for the connector.
:param connector_type: (Optional) Type of connector, defaults to MCP.
:param headers: (Optional) HTTP headers to include when connecting to the server.
:param authorization: (Optional) OAuth access token for authenticating with the MCP server.
:returns: The registered Connector.
"""
# Fetch server info and tools from the MCP server
# TODO: documentation item: users should be able to pass headers and authorization in the connector input as env variables.
server_info = await get_mcp_server_info(url, headers=headers, authorization=authorization)
tools_response = await list_mcp_tools(url, headers=headers, authorization=authorization)
connector = Connector(
identifier=server_info.name,
provider_id="builtin::connectors",
user_connector_id=connector_id,
connector_type=connector_type,
url=url,
created_at=datetime.now(UTC),
updated_at=datetime.now(UTC),
server_name=server_info.name,
server_label=server_info.title,
server_description=server_info.description,
tools=tools_response.data,
)
logger.info(f"Registered connector {connector.connector_id} with server name {connector.server_name}")
self.connectors_map[connector.connector_id] = connector
return connector
async def list_connectors(
self,
registry_id: str | None = None,
include_tools: bool = False,
) -> ListConnectorsResponse:
"""List all configured connectors.
:param registry_id: (Optional) The ID of a registry to filter connectors for.
:param include_tools: (Optional) Whether to include tools in the response.
:returns: A ListConnectorsResponse.
"""
connectors = [c for c in self.connectors_map.values() if registry_id is None or c.registry_id == registry_id]
if not include_tools:
return ListConnectorsResponse(data=[c.without_tools for c in connectors])
return ListConnectorsResponse(data=connectors)
async def get_connector(self, connector_id: str, include_tools: bool = False) -> Connector:
"""Get a connector by its ID.
:param connector_id: The ID of the connector to get.
:returns: A Connector.
:raises ConnectorNotFoundError: If the connector is not found.
"""
connector = self.connectors_map.get(connector_id)
if connector is None:
raise ConnectorNotFoundError(connector_id)
if not include_tools:
return connector.without_tools
return connector
async def list_connector_tools(self, connector_id: str) -> ListToolsResponse:
"""List tools available from a connector.
:param connector_id: The ID of the connector to list tools for.
:returns: A ListToolsResponse.
:raises ConnectorNotFoundError: If the connector is not found.
"""
connector = await self.get_connector(connector_id, include_tools=True)
# Return empty list if no tools, rather than raising
return ListToolsResponse(data=connector.tools or [])
async def get_connector_tool(self, connector_id: str, tool_name: str) -> ToolDef:
"""Get a tool definition by its name from a connector.
:param connector_id: The ID of the connector to get the tool from.
:param tool_name: The name of the tool to get.
:returns: A ToolDef.
:raises ConnectorNotFoundError: If the connector is not found.
:raises ConnectorToolNotFoundError: If the tool is not found in the connector.
"""
connector_tools = await self.list_connector_tools(connector_id)
for tool in connector_tools.data:
if tool.name == tool_name:
return tool
raise ConnectorToolNotFoundError(connector_id, tool_name)
async def list_registries(self) -> ListRegistriesResponse:
"""List all registries.
:returns: A ListRegistriesResponse.
"""
return ListRegistriesResponse(data=list(self.registries_map.values()))
async def get_registry(self, registry_id: str) -> Registry:
"""Get a registry by its ID.
:param registry_id: The ID of the registry to get.
:returns: A Registry.
:raises RegistryNotFoundError: If the registry is not found.
"""
registry = self.registries_map.get(registry_id)
if registry is None:
raise RegistryNotFoundError(registry_id)
return registry
async def shutdown(self) -> None:
self.connectors_map.clear()
self.registries_map.clear()

View file

@ -22,6 +22,7 @@ from llama_stack_api import (
Api,
Benchmark,
BenchmarkInput,
ConnectorInput,
Dataset,
DatasetInput,
DatasetIO,
@ -429,6 +430,7 @@ class RegisteredResources(BaseModel):
scoring_fns: list[ScoringFnInput] = Field(default_factory=list)
benchmarks: list[BenchmarkInput] = Field(default_factory=list)
tool_groups: list[ToolGroupInput] = Field(default_factory=list)
connectors: list[ConnectorInput] = Field(default_factory=list)
class ServerConfig(BaseModel):

View file

@ -28,6 +28,7 @@ from llama_stack_api import (
Batches,
Benchmarks,
BenchmarksProtocolPrivate,
Connectors,
Conversations,
DatasetIO,
Datasets,
@ -100,6 +101,7 @@ def api_protocol_map(external_apis: dict[Api, ExternalApiSpec] | None = None) ->
Api.files: Files,
Api.prompts: Prompts,
Api.conversations: Conversations,
Api.connectors: Connectors,
}
if external_apis:

View file

@ -454,6 +454,7 @@ def create_app() -> StackApp:
apis_to_serve.add("providers")
apis_to_serve.add("prompts")
apis_to_serve.add("conversations")
apis_to_serve.add("connectors")
for api_str in apis_to_serve:
api = Api(api_str)

View file

@ -13,6 +13,7 @@ from typing import Any
import yaml
from llama_stack.core.connectors.connectors import ConnectorServiceConfig, ConnectorServiceImpl
from llama_stack.core.conversations.conversations import ConversationServiceConfig, ConversationServiceImpl
from llama_stack.core.datatypes import Provider, SafetyConfig, StackRunConfig, VectorStoresConfig
from llama_stack.core.distribution import get_provider_registry
@ -39,6 +40,7 @@ from llama_stack_api import (
Api,
Batches,
Benchmarks,
Connectors,
Conversations,
DatasetIO,
Datasets,
@ -64,6 +66,7 @@ logger = get_logger(name=__name__, category="core")
class LlamaStack(
Providers,
Connectors,
Inference,
Agents,
Batches,
@ -100,6 +103,7 @@ RESOURCES = [
),
("benchmarks", Api.benchmarks, "register_benchmark", "list_benchmarks"),
("tool_groups", Api.tool_groups, "register_tool_group", "list_tool_groups"),
("connectors", Api.connectors, "register_connector", "list_connectors"),
]
@ -372,6 +376,11 @@ def add_internal_implementations(impls: dict[Api, Any], run_config: StackRunConf
)
impls[Api.conversations] = conversations_impl
connectors_impl = ConnectorServiceImpl(
ConnectorServiceConfig(run_config=run_config),
)
impls[Api.connectors] = connectors_impl
def _initialize_storage(run_config: StackRunConfig):
kv_backends: dict[str, StorageBackendConfig] = {}

View file

@ -50,6 +50,7 @@ CATEGORIES = [
"post_training",
"scoring",
"tests",
"connectors",
]
UNCATEGORIZED = "uncategorized"

View file

@ -28,6 +28,7 @@ async def get_provider_impl(
deps[Api.conversations],
deps[Api.prompts],
deps[Api.files],
deps[Api.connectors],
policy,
)
await impl.initialize()

View file

@ -11,6 +11,7 @@ from llama_stack.log import get_logger
from llama_stack.providers.utils.responses.responses_store import ResponsesStore
from llama_stack_api import (
Agents,
Connectors,
Conversations,
Files,
Inference,
@ -49,6 +50,7 @@ class MetaReferenceAgentsImpl(Agents):
conversations_api: Conversations,
prompts_api: Prompts,
files_api: Files,
connectors_api: Connectors,
policy: list[AccessRule],
):
self.config = config
@ -60,6 +62,7 @@ class MetaReferenceAgentsImpl(Agents):
self.conversations_api = conversations_api
self.prompts_api = prompts_api
self.files_api = files_api
self.connectors_api = connectors_api
self.in_memory_store = InmemoryKVStoreImpl()
self.openai_responses_impl: OpenAIResponsesImpl | None = None
self.policy = policy
@ -78,6 +81,7 @@ class MetaReferenceAgentsImpl(Agents):
conversations_api=self.conversations_api,
prompts_api=self.prompts_api,
files_api=self.files_api,
connectors_api=self.connectors_api,
)
async def shutdown(self) -> None:

View file

@ -17,6 +17,7 @@ from llama_stack.providers.utils.responses.responses_store import (
_OpenAIResponseObjectWithInputAndMessages,
)
from llama_stack_api import (
Connectors,
ConversationItem,
Conversations,
Files,
@ -79,6 +80,7 @@ class OpenAIResponsesImpl:
conversations_api: Conversations,
prompts_api: Prompts,
files_api: Files,
connectors_api: Connectors,
):
self.inference_api = inference_api
self.tool_groups_api = tool_groups_api
@ -94,6 +96,7 @@ class OpenAIResponsesImpl:
)
self.prompts_api = prompts_api
self.files_api = files_api
self.connectors_api = connectors_api
async def _prepend_previous_response(
self,
@ -494,6 +497,7 @@ class OpenAIResponsesImpl:
instructions=instructions,
max_tool_calls=max_tool_calls,
metadata=metadata,
connectors_api=self.connectors_api,
)
# Stream the response

View file

@ -15,6 +15,7 @@ from llama_stack.providers.utils.inference.prompt_adapter import interleaved_con
from llama_stack_api import (
AllowedToolsFilter,
ApprovalFilter,
Connectors,
Inference,
MCPListToolsTool,
ModelNotFoundError,
@ -121,8 +122,10 @@ class StreamingResponseOrchestrator:
parallel_tool_calls: bool | None = None,
max_tool_calls: int | None = None,
metadata: dict[str, str] | None = None,
connectors_api: Connectors | None = None,
):
self.inference_api = inference_api
self.connectors_api = connectors_api
self.ctx = ctx
self.response_id = response_id
self.created_at = created_at
@ -1088,6 +1091,15 @@ class StreamingResponseOrchestrator:
"""Process an MCP tool configuration and emit appropriate streaming events."""
from llama_stack.providers.utils.tools.mcp import list_mcp_tools
# Resolve connector_id to server_url if provided
if mcp_tool.connector_id and not mcp_tool.server_url:
if self.connectors_api is None:
raise ValueError("Connectors API not available to resolve connector_id")
server_url = self.connectors_api.get_connector_url(mcp_tool.connector_id)
if not server_url:
raise ValueError(f"Connector {mcp_tool.connector_id} not found")
mcp_tool = mcp_tool.model_copy(update={"server_url": server_url})
# Emit mcp_list_tools.in_progress
self.sequence_number += 1
yield OpenAIResponseObjectStreamResponseMcpListToolsInProgress(

View file

@ -36,6 +36,7 @@ def available_providers() -> list[ProviderSpec]:
Api.conversations,
Api.prompts,
Api.files,
Api.connectors,
],
optional_api_dependencies=[
Api.safety,

View file

@ -228,3 +228,44 @@ async def invoke_mcp_tool(
content=content,
error_code=1 if result.isError else 0,
)
from dataclasses import dataclass
@dataclass
class MCPServerInfo:
"""Server information from an MCP server."""
name: str
version: str
title: str | None = None
description: str | None = None
async def get_mcp_server_info(
endpoint: str,
headers: dict[str, str] | None = None,
authorization: str | None = None,
) -> MCPServerInfo:
"""Get server info from an MCP server.
Args:
endpoint: MCP server endpoint URL
headers: Optional base headers to include
authorization: Optional OAuth access token (just the token, not "Bearer <token>")
Returns:
MCPServerInfo containing name, version, title, and description
"""
final_headers = prepare_mcp_headers(headers, authorization)
async with client_wrapper(endpoint, final_headers) as session:
init_result = await session.initialize()
return MCPServerInfo(
name=init_result.serverInfo.name,
version=init_result.serverInfo.version,
title=init_result.serverInfo.title,
description=init_result.instructions,
)

View file

@ -46,10 +46,13 @@ from .common.content_types import (
)
from .common.errors import (
ConflictError,
ConnectorNotFoundError,
ConnectorToolNotFoundError,
DatasetNotFoundError,
InvalidConversationIdError,
ModelNotFoundError,
ModelTypeError,
RegistryNotFoundError,
ResourceNotFoundError,
TokenValidationError,
ToolGroupNotFoundError,
@ -66,6 +69,14 @@ from .common.type_system import (
ParamType,
StringType,
)
from .connectors import (
Connector,
ConnectorInput,
Connectors,
ConnectorType,
ListConnectorsResponse,
ListToolsResponse,
)
from .conversations import (
Conversation,
ConversationDeletedResource,
@ -340,6 +351,12 @@ from .rag_tool import (
RRFRanker,
WeightedRanker,
)
from .registries import (
ListRegistriesResponse,
Registry,
RegistryInput,
RegistryType,
)
from .resource import Resource, ResourceType
from .safety import (
ModerationObject,
@ -482,6 +499,12 @@ __all__ = [
"CommonShieldFields",
"CompletionInputType",
"CompletionRequest",
"Connector",
"ConnectorInput",
"Connectors",
"ConnectorType",
"ConnectorNotFoundError",
"ConnectorToolNotFoundError",
"Conversation",
"ConversationDeletedResource",
"ConversationItem",
@ -556,6 +579,7 @@ __all__ = [
"LLMRAGQueryGeneratorConfig",
"ListBatchesResponse",
"ListBenchmarksResponse",
"ListConnectorsResponse",
"ListDatasetsResponse",
"ListModelsResponse",
"ListOpenAIChatCompletionResponse",
@ -565,11 +589,13 @@ __all__ = [
"ListPostTrainingJobsResponse",
"ListPromptsResponse",
"ListProvidersResponse",
"ListRegistriesResponse",
"ListRoutesResponse",
"ListScoringFunctionsResponse",
"ListShieldsResponse",
"ListToolDefsResponse",
"ListToolGroupsResponse",
"ListToolsResponse",
"LogProbConfig",
"LoraFinetuningConfig",
"MCPListToolsTool",
@ -753,6 +779,10 @@ __all__ = [
"RRFRanker",
"Ranker",
"RegexParserScoringFnParams",
"Registry",
"RegistryNotFoundError",
"RegistryType",
"RegistryInput",
"RemoteProviderConfig",
"RemoteProviderSpec",
"RerankData",

View file

@ -80,6 +80,28 @@ class TokenValidationError(ValueError):
super().__init__(message)
class ConnectorNotFoundError(ResourceNotFoundError):
"""raised when Llama Stack cannot find a referenced connector"""
def __init__(self, connector_id: str) -> None:
super().__init__(connector_id, "Connector", "client.connectors.list()")
class ConnectorToolNotFoundError(ValueError):
"""raised when Llama Stack cannot find a referenced tool in a connector"""
def __init__(self, connector_id: str, tool_name: str) -> None:
message = f"Tool '{tool_name}' not found in connector '{connector_id}'. Use 'client.connectors.list_tools(\"{connector_id}\")' to list available tools."
super().__init__(message)
class RegistryNotFoundError(ResourceNotFoundError):
"""raised when Llama Stack cannot find a referenced registry"""
def __init__(self, registry_id: str) -> None:
super().__init__(registry_id, "Registry", "client.connectors.list_registries()")
class ConversationNotFoundError(ResourceNotFoundError):
"""raised when Llama Stack cannot find a referenced conversation"""

View file

@ -0,0 +1,189 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from datetime import datetime
from enum import StrEnum
from typing import Any, Literal, Protocol
from pydantic import BaseModel, Field
from typing_extensions import runtime_checkable
from llama_stack_api.registries import ListRegistriesResponse, Registry
from llama_stack_api.resource import Resource, ResourceType
from llama_stack_api.schema_utils import json_schema_type, webmethod
from llama_stack_api.tools import ToolDef
from llama_stack_api.version import LLAMA_STACK_API_V1ALPHA
@json_schema_type
class ConnectorType(StrEnum):
"""Type of connector."""
MCP = "mcp"
@json_schema_type
class Connector(Resource):
"""A connector resource representing a connector registered in Llama Stack.
:param type: Type of resource, always 'connector' for connectors
:param connector_type: Type of connector (e.g., MCP)
:param connector_id: User-specified identifier for the connector
:param url: URL of the connector
:param created_at: Timestamp of creation
:param updated_at: Timestamp of last update
:param server_label: (Optional) Label of the server
:param server_description: (Optional) Description of the server
:param tools: (Optional) List of tools available from the connector
:param registry_id: (Optional) ID of the registry this connector belongs to
"""
model_config = {"populate_by_name": True}
type: Literal[ResourceType.connector] = ResourceType.connector
connector_type: ConnectorType = Field(default=ConnectorType.MCP)
user_connector_id: str | None = Field(
default=None, alias="connector_id", description="User-specified identifier for the connector"
)
url: str = Field(..., description="URL of the connector")
created_at: datetime = Field(..., description="Timestamp of creation")
updated_at: datetime = Field(..., description="Timestamp of last update")
server_name: str | None = Field(default=None, description="Name of the server")
server_label: str | None = Field(default=None, description="Label of the server")
server_description: str | None = Field(default=None, description="Description of the server")
# TODO: using ToolDef for now, but MCPListToolsTool should probably be updated and used instead
# once toolgroups are removed completely
tools: list[ToolDef] | None = Field(default=None, description="List of tools available from the connector")
registry_id: str | None = Field(default=None, description="ID of the registry this connector belongs to")
def _generate_connector_id(self) -> str:
name = self.server_name if self.server_name is not None else self.identifier
if self.registry_id is not None:
return f"{self.connector_type.value}::{self.registry_id}::{name}"
return f"{self.connector_type.value}::{name}"
@property
def connector_id(self) -> str:
return self.user_connector_id if self.user_connector_id is not None else self._generate_connector_id()
@property
def without_tools(self) -> "Connector":
"""Return a copy of this connector with tools removed."""
return self.model_copy(update={"tools": None})
@json_schema_type
class ConnectorInput(BaseModel):
"""Input for creating a connector.
:param connector_type: Type of connector
:param connector_id: Unique identifier for the connector
:param url: URL of the connector
:param headers: (Optional) HTTP headers to include when connecting to the server
:param authorization: (Optional) OAuth access token for authenticating with the MCP server
"""
connector_type: ConnectorType = Field(default=ConnectorType.MCP)
connector_id: str | None = Field(default=None, description="Unique identifier for the connector")
url: str = Field(..., description="URL of the connector")
headers: dict[str, Any] | None = Field(default=None, description="HTTP headers to include when connecting")
authorization: str | None = Field(default=None, description="OAuth access token for authentication")
@json_schema_type
class ListConnectorsResponse(BaseModel):
"""Response containing a list of connectors.
:param data: List of connectors
"""
data: list[Connector]
@json_schema_type
class ListToolsResponse(BaseModel):
"""Response containing a list of tools.
:param data: List of tools
"""
data: list[ToolDef]
@runtime_checkable
class Connectors(Protocol):
# NOTE: Route order matters! More specific routes must come before less specific ones.
# Routes with {param:path} are greedy and will match everything including slashes.
@webmethod(route="/connectors", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def list_connectors(
self,
registry_id: str | None = None,
include_tools: bool = False,
) -> ListConnectorsResponse:
"""List all configured connectors.
:param registry_id: (Optional) The ID of a registry to filter connectors for.
:param include_tools: (Optional) Whether to include tools in the response.
:returns: A ListConnectorsResponse.
"""
...
@webmethod(route="/connectors/registries", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def list_registries(self) -> ListRegistriesResponse:
"""List all registries.
:returns: A ListRegistriesResponse.
"""
...
@webmethod(route="/connectors/registries/{registry_id}", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def get_registry(self, registry_id: str) -> Registry:
"""Get a registry by its ID.
:param registry_id: The ID of the registry to get.
:returns: A Registry.
"""
...
@webmethod(route="/connectors/{connector_id}/tools/{tool_name}", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def get_connector_tool(
self,
connector_id: str,
tool_name: str,
) -> ToolDef:
"""Get a tool definition by its name from a connector.
:param connector_id: The ID of the connector to get the tool from.
:param tool_name: The name of the tool to get.
:returns: A ToolDef.
"""
...
@webmethod(route="/connectors/{connector_id}/tools", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def list_connector_tools(
self,
connector_id: str,
) -> ListToolsResponse:
"""List tools available from a connector.
:param connector_id: The ID of the connector to list tools for.
:returns: A ListToolsResponse.
"""
...
@webmethod(route="/connectors/{connector_id}", method="GET", level=LLAMA_STACK_API_V1ALPHA)
async def get_connector(
self,
connector_id: str,
include_tools: bool = False,
) -> Connector:
"""Get a connector by its ID.
:param connector_id: The ID of the connector to get.
:returns: A Connector.
"""
...

View file

@ -111,6 +111,7 @@ class Api(Enum, metaclass=DynamicApiMeta):
:cvar tool_groups: Tool group organization
:cvar files: File storage and management
:cvar prompts: Prompt versions and management
:cvar connectors: External connector management (e.g., MCP servers)
:cvar inspect: Built-in system inspection and introspection
"""
@ -136,6 +137,7 @@ class Api(Enum, metaclass=DynamicApiMeta):
files = "files"
prompts = "prompts"
conversations = "conversations"
connectors = "connectors"
# built-in API
inspect = "inspect"

View file

@ -5,7 +5,7 @@
# the root directory of this source tree.
from collections.abc import Sequence
from typing import Annotated, Any, Literal
from typing import Annotated, Any, Literal, Self
from pydantic import BaseModel, Field, model_validator
from typing_extensions import TypedDict
@ -488,7 +488,8 @@ class OpenAIResponseInputToolMCP(BaseModel):
:param type: Tool type identifier, always "mcp"
:param server_label: Label to identify this MCP server
:param server_url: URL endpoint of the MCP server
:param server_url: (Optional) URL endpoint of the MCP server
:param connector_id: (Optional) ID of the connector to use for this MCP server
:param headers: (Optional) HTTP headers to include when connecting to the server
:param authorization: (Optional) OAuth access token for authenticating with the MCP server
:param require_approval: Approval requirement for tool calls ("always", "never", or filter)
@ -497,13 +498,20 @@ class OpenAIResponseInputToolMCP(BaseModel):
type: Literal["mcp"] = "mcp"
server_label: str
server_url: str
server_url: str | None = None
connector_id: str | None = None
headers: dict[str, Any] | None = None
authorization: str | None = Field(default=None, exclude=True)
require_approval: Literal["always"] | Literal["never"] | ApprovalFilter = "never"
allowed_tools: list[str] | AllowedToolsFilter | None = None
@model_validator(mode="after")
def validate_server_or_connector(self) -> Self:
if not self.server_url and not self.connector_id:
raise ValueError("Either 'server_url' or 'connector_id' must be provided for MCP tool")
return self
OpenAIResponseInputTool = Annotated[
OpenAIResponseInputToolWebSearch

View file

@ -0,0 +1,68 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from datetime import datetime
from enum import StrEnum
from typing import Literal
from pydantic import BaseModel, Field
from llama_stack_api.resource import Resource, ResourceType
from llama_stack_api.schema_utils import json_schema_type
@json_schema_type
class RegistryType(StrEnum):
"""Type of registry."""
MCP = "mcp"
@json_schema_type
class Registry(Resource):
"""A registry resource representing a registry of connectors.
:param type: Type of resource, always 'registry' for registries
:param identifier: Unique identifier for this resource in llama stack
:param provider_resource_id: Unique identifier for this resource in the provider
:param provider_id: ID of the provider that owns this resource
:param type: Type of resource (e.g. 'model', 'shield', 'vector_store', etc.)
"""
type: Literal[ResourceType.registry] = ResourceType.registry
registry_type: RegistryType = Field(default=RegistryType.MCP)
user_registry_id: str | None = Field(default=None, description="User-specified identifier for the registry")
url: str = Field(..., description="URL of the registry")
created_at: datetime = Field(..., description="Timestamp of creation")
updated_at: datetime = Field(..., description="Timestamp of last update")
@property
def registry_id(self) -> str:
return self.user_registry_id if self.user_registry_id is not None else self.identifier
@json_schema_type
class ListRegistriesResponse(BaseModel):
"""Response containing a list of registries.
:param data: List of registries
"""
data: list[Registry]
@json_schema_type
class RegistryInput(BaseModel):
"""Input for creating a registry.
:param url: URL of the registry
:param user_registry_id: User-specified identifier for the registry
"""
url: str
user_registry_id: str | None = Field(default=None, description="User-specified identifier for the registry")
registry_type: RegistryType = Field(default=RegistryType.MCP)

View file

@ -20,6 +20,8 @@ class ResourceType(StrEnum):
tool = "tool"
tool_group = "tool_group"
prompt = "prompt"
connector = "connector"
registry = "registry"
class Resource(BaseModel):