Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions oas_docs/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -2823,10 +2823,10 @@
"x-state": "Technical Preview; added in 9.2.0"
}
},
"/api/agent_builder/tools/{id}": {
"/api/agent_builder/tools/{toolId}": {
"delete": {
"description": "Delete a tool by ID. This action cannot be undone.<br/><br/>[Required authorization] Route required privileges: manage_onechat.",
"operationId": "delete-agent-builder-tools-id",
"operationId": "delete-agent-builder-tools-toolid",
"parameters": [
{
"description": "A required header to protect against CSRF attacks",
Expand All @@ -2841,7 +2841,7 @@
{
"description": "The unique identifier of the tool to delete.",
"in": "path",
"name": "id",
"name": "toolId",
"required": true,
"schema": {
"type": "string"
Expand Down Expand Up @@ -2873,12 +2873,12 @@
},
"get": {
"description": "Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements.<br/><br/>[Required authorization] Route required privileges: read_onechat.",
"operationId": "get-agent-builder-tools-id",
"operationId": "get-agent-builder-tools-toolid",
"parameters": [
{
"description": "The unique identifier of the tool to retrieve.",
"in": "path",
"name": "id",
"name": "toolId",
"required": true,
"schema": {
"type": "string"
Expand Down Expand Up @@ -3007,9 +3007,7 @@
"agent builder"
],
"x-state": "Technical Preview; added in 9.2.0"
}
},
"/api/agent_builder/tools/{toolId}": {
},
"put": {
"description": "Update an existing tool. Use this endpoint to modify any aspect of the tool's configuration or metadata.<br/><br/>[Required authorization] Route required privileges: manage_onechat.",
"operationId": "put-agent-builder-tools-toolid",
Expand Down
14 changes: 6 additions & 8 deletions oas_docs/bundle.serverless.json
Original file line number Diff line number Diff line change
Expand Up @@ -2823,10 +2823,10 @@
"x-state": "Technical Preview"
}
},
"/api/agent_builder/tools/{id}": {
"/api/agent_builder/tools/{toolId}": {
"delete": {
"description": "Delete a tool by ID. This action cannot be undone.<br/><br/>[Required authorization] Route required privileges: manage_onechat.",
"operationId": "delete-agent-builder-tools-id",
"operationId": "delete-agent-builder-tools-toolid",
"parameters": [
{
"description": "A required header to protect against CSRF attacks",
Expand All @@ -2841,7 +2841,7 @@
{
"description": "The unique identifier of the tool to delete.",
"in": "path",
"name": "id",
"name": "toolId",
"required": true,
"schema": {
"type": "string"
Expand Down Expand Up @@ -2873,12 +2873,12 @@
},
"get": {
"description": "Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements.<br/><br/>[Required authorization] Route required privileges: read_onechat.",
"operationId": "get-agent-builder-tools-id",
"operationId": "get-agent-builder-tools-toolid",
"parameters": [
{
"description": "The unique identifier of the tool to retrieve.",
"in": "path",
"name": "id",
"name": "toolId",
"required": true,
"schema": {
"type": "string"
Expand Down Expand Up @@ -3007,9 +3007,7 @@
"agent builder"
],
"x-state": "Technical Preview"
}
},
"/api/agent_builder/tools/{toolId}": {
},
"put": {
"description": "Update an existing tool. Use this endpoint to modify any aspect of the tool's configuration or metadata.<br/><br/>[Required authorization] Route required privileges: manage_onechat.",
"operationId": "put-agent-builder-tools-toolid",
Expand Down
15 changes: 7 additions & 8 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2581,17 +2581,17 @@ paths:
x-metaTags:
- content: Kibana, Elastic Cloud Serverless
name: product_name
/api/agent_builder/tools/{id}:
/api/agent_builder/tools/{toolId}:
delete:
description: |-
**Spaces method and path for this operation:**

<div><span class="operation-verb delete">delete</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{id}</span></div>
<div><span class="operation-verb delete">delete</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{toolId}</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Delete a tool by ID. This action cannot be undone.<br/><br/>[Required authorization] Route required privileges: manage_onechat.
operationId: delete-agent-builder-tools-id
operationId: delete-agent-builder-tools-toolid
parameters:
- description: A required header to protect against CSRF attacks
in: header
Expand All @@ -2602,7 +2602,7 @@ paths:
type: string
- description: The unique identifier of the tool to delete.
in: path
name: id
name: toolId
required: true
schema:
type: string
Expand All @@ -2627,16 +2627,16 @@ paths:
description: |-
**Spaces method and path for this operation:**

<div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{id}</span></div>
<div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{toolId}</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements.<br/><br/>[Required authorization] Route required privileges: read_onechat.
operationId: get-agent-builder-tools-id
operationId: get-agent-builder-tools-toolid
parameters:
- description: The unique identifier of the tool to retrieve.
in: path
name: id
name: toolId
required: true
schema:
type: string
Expand Down Expand Up @@ -2750,7 +2750,6 @@ paths:
x-metaTags:
- content: Kibana, Elastic Cloud Serverless
name: product_name
/api/agent_builder/tools/{toolId}:
put:
description: |-
**Spaces method and path for this operation:**
Expand Down
15 changes: 7 additions & 8 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2646,17 +2646,17 @@ paths:
x-metaTags:
- content: Kibana
name: product_name
/api/agent_builder/tools/{id}:
/api/agent_builder/tools/{toolId}:
delete:
description: |-
**Spaces method and path for this operation:**

<div><span class="operation-verb delete">delete</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{id}</span></div>
<div><span class="operation-verb delete">delete</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{toolId}</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Delete a tool by ID. This action cannot be undone.<br/><br/>[Required authorization] Route required privileges: manage_onechat.
operationId: delete-agent-builder-tools-id
operationId: delete-agent-builder-tools-toolid
parameters:
- description: A required header to protect against CSRF attacks
in: header
Expand All @@ -2667,7 +2667,7 @@ paths:
type: string
- description: The unique identifier of the tool to delete.
in: path
name: id
name: toolId
required: true
schema:
type: string
Expand All @@ -2692,16 +2692,16 @@ paths:
description: |-
**Spaces method and path for this operation:**

<div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{id}</span></div>
<div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/agent_builder/tools/{toolId}</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Get a specific tool by ID. Use this endpoint to retrieve the complete tool definition including its schema and configuration requirements.<br/><br/>[Required authorization] Route required privileges: read_onechat.
operationId: get-agent-builder-tools-id
operationId: get-agent-builder-tools-toolid
parameters:
- description: The unique identifier of the tool to retrieve.
in: path
name: id
name: toolId
required: true
schema:
type: string
Expand Down Expand Up @@ -2815,7 +2815,6 @@ paths:
x-metaTags:
- content: Kibana
name: product_name
/api/agent_builder/tools/{toolId}:
put:
description: |-
**Spaces method and path for this operation:**
Expand Down
16 changes: 8 additions & 8 deletions x-pack/platform/plugins/shared/onechat/server/routes/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function registerToolsRoutes({ router, getInternalServices, logger }: Rou
// get tool by ID
router.versioned
.get({
path: `${publicApiPath}/tools/{id}`,
path: `${publicApiPath}/tools/{toolId}`,
security: {
authz: { requiredPrivileges: [apiPrivileges.readOnechat] },
},
Expand All @@ -91,7 +91,7 @@ export function registerToolsRoutes({ router, getInternalServices, logger }: Rou
validate: {
request: {
params: schema.object({
id: schema.string({
toolId: schema.string({
meta: { description: 'The unique identifier of the tool to retrieve.' },
}),
}),
Expand All @@ -102,10 +102,10 @@ export function registerToolsRoutes({ router, getInternalServices, logger }: Rou
},
},
wrapHandler(async (ctx, request, response) => {
const { id } = request.params;
const { toolId } = request.params;
const { tools: toolService } = getInternalServices();
const registry = await toolService.getRegistry({ request });
const tool = await registry.get(id);
const tool = await registry.get(toolId);
return response.ok<GetToolResponse>({
body: await toDescriptorWithSchema(tool),
});
Expand Down Expand Up @@ -260,7 +260,7 @@ export function registerToolsRoutes({ router, getInternalServices, logger }: Rou
// delete tool
router.versioned
.delete({
path: `${publicApiPath}/tools/{id}`,
path: `${publicApiPath}/tools/{toolId}`,
security: {
authz: { requiredPrivileges: [apiPrivileges.manageOnechat] },
},
Expand All @@ -281,7 +281,7 @@ export function registerToolsRoutes({ router, getInternalServices, logger }: Rou
validate: {
request: {
params: schema.object({
id: schema.string({
toolId: schema.string({
meta: { description: 'The unique identifier of the tool to delete.' },
}),
}),
Expand All @@ -292,10 +292,10 @@ export function registerToolsRoutes({ router, getInternalServices, logger }: Rou
},
},
wrapHandler(async (ctx, request, response) => {
const { id } = request.params;
const { toolId } = request.params;
const { tools: toolService } = getInternalServices();
const registry = await toolService.getRegistry({ request });
const success = await registry.delete(id);
const success = await registry.delete(toolId);
return response.ok<DeleteToolResponse>({
body: { success },
});
Expand Down