mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-25 02:33:00 +08:00
FEAT: Add Brave Search and Trello(12 Tools) Included (#3040)
This commit is contained in:
1
api/core/tools/provider/builtin/trello/_assets/icon.svg
Normal file
1
api/core/tools/provider/builtin/trello/_assets/icon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg width="2500" height="2500" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="a"><stop stop-color="#0091E6" offset="0%"/><stop stop-color="#0079BF" offset="100%"/></linearGradient></defs><rect fill="url(#a)" width="256" height="256" rx="25"/><rect fill="#FFF" x="144.64" y="33.28" width="78.08" height="112" rx="12"/><rect fill="#FFF" x="33.28" y="33.28" width="78.08" height="176" rx="12"/></svg>
|
||||
|
After Width: | Height: | Size: 501 B |
47
api/core/tools/provider/builtin/trello/tools/create_board.py
Normal file
47
api/core/tools/provider/builtin/trello/tools/create_board.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class CreateBoardTool(BuiltinTool):
|
||||
"""
|
||||
Tool for creating a new Trello board.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to create a new Trello board.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_name = tool_parameters.get('name')
|
||||
|
||||
if not (api_key and token and board_name):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board name.")
|
||||
|
||||
url = "https://api.trello.com/1/boards/"
|
||||
query_params = {
|
||||
'name': board_name,
|
||||
'key': api_key,
|
||||
'token': token
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, params=query_params)
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to create board")
|
||||
|
||||
board = response.json()
|
||||
return self.create_text_message(text=f"Board created successfully! Board name: {board['name']}, ID: {board['id']}")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: create_board
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Create Board
|
||||
zh_Hans: 创建看板
|
||||
pt_BR: Criar Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Creates a new Trello board with a specified name. This tool allows users to quickly add new boards to their Trello account, facilitating project organization and management.
|
||||
zh_Hans: 使用指定的名称创建一个新的 Trello 看板。此工具允许用户快速向其 Trello 账户添加新的看板,促进项目组织和管理。
|
||||
pt_BR: Cria um novo quadro Trello com um nome especificado. Esta ferramenta permite que os usuários adicionem rapidamente novos quadros à sua conta Trello, facilitando a organização e gestão de projetos.
|
||||
llm: Create a new Trello board using the specified name. This functionality simplifies the addition of boards, enhancing project organization and management within Trello.
|
||||
parameters:
|
||||
- name: name
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board Name
|
||||
zh_Hans: 看板名称
|
||||
pt_BR: Nome do Quadro
|
||||
human_description:
|
||||
en_US: The name for the new Trello board. This name helps in identifying and organizing your projects on Trello.
|
||||
zh_Hans: 新 Trello 看板的名称。这个名称有助于在 Trello 上识别和组织您的项目。
|
||||
pt_BR: O nome para o novo quadro Trello. Este nome ajuda a identificar e organizar seus projetos no Trello.
|
||||
llm_description: Specify the name for your new Trello board, aiding in project identification and organization within Trello.
|
||||
form: llm
|
||||
@@ -0,0 +1,48 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class CreateListOnBoardTool(BuiltinTool):
|
||||
"""
|
||||
Tool for creating a list on a Trello board by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to create a list on a Trello board by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID and list name.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('id')
|
||||
list_name = tool_parameters.get('name')
|
||||
|
||||
if not (api_key and token and board_id and list_name):
|
||||
return self.create_text_message("Missing required parameters: API key, token, board ID, or list name.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}/lists"
|
||||
params = {
|
||||
'name': list_name,
|
||||
'key': api_key,
|
||||
'token': token
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, params=params)
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to create list")
|
||||
|
||||
new_list = response.json()
|
||||
return self.create_text_message(text=f"List '{new_list['name']}' created successfully with Id {new_list['id']} on board {board_id}.")
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
identity:
|
||||
name: create_list_on_board
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Create List on Board
|
||||
zh_Hans: 在看板上创建列表
|
||||
pt_BR: Criar Lista no Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Creates a new list on a specified Trello board by providing the board's ID and the desired name for the list. Streamlines the process of organizing board content.
|
||||
zh_Hans: 通过提供看板的 ID 和列表的所需名称,在指定的 Trello 看板上创建一个新列表。简化了组织看板内容的过程。
|
||||
pt_BR: Cria uma nova lista em um quadro Trello especificado, fornecendo o ID do quadro e o nome desejado para a lista. Facilita o processo de organização do conteúdo do quadro.
|
||||
llm: Generate a new list within a Trello board by specifying the board's ID and a name for the list. Enhances board management by allowing quick additions of new lists.
|
||||
parameters:
|
||||
- name: id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello board where the new list will be created.
|
||||
zh_Hans: 新列表将被创建在其上的 Trello 看板的唯一标识符。
|
||||
pt_BR: O identificador único do quadro Trello onde a nova lista será criada.
|
||||
llm_description: Input the ID of the Trello board to pinpoint where the new list should be added, ensuring correct placement.
|
||||
form: llm
|
||||
- name: name
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: List Name
|
||||
zh_Hans: 列表名称
|
||||
pt_BR: Nome da Lista
|
||||
human_description:
|
||||
en_US: The name for the new list to be created on the Trello board.
|
||||
zh_Hans: 将在 Trello 看板上创建的新列表的名称。
|
||||
pt_BR: O nome para a nova lista que será criada no quadro Trello.
|
||||
llm_description: Provide a name for the new list, defining its purpose or content focus, to facilitate board organization.
|
||||
form: llm
|
||||
@@ -0,0 +1,43 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class CreateNewCardOnBoardTool(BuiltinTool):
|
||||
"""
|
||||
Tool for creating a new card on a Trello board.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool, None]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to create a new card on a Trello board.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool, None]]): The parameters for the tool invocation, including details for the new card.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
|
||||
# Ensure required parameters are present
|
||||
if 'name' not in tool_parameters or 'idList' not in tool_parameters:
|
||||
return self.create_text_message("Missing required parameters: name or idList.")
|
||||
|
||||
url = "https://api.trello.com/1/cards"
|
||||
params = {**tool_parameters, 'key': api_key, 'token': token}
|
||||
|
||||
try:
|
||||
response = requests.post(url, params=params)
|
||||
response.raise_for_status()
|
||||
new_card = response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to create card")
|
||||
|
||||
return self.create_text_message(text=f"New card '{new_card['name']}' created successfully with ID {new_card['id']}.")
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
identity:
|
||||
name: create_new_card_on_board
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Create New Card on Board
|
||||
zh_Hans: 在看板上创建新卡片
|
||||
pt_BR: Criar Novo Cartão no Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Creates a new card on a Trello board with specified details like name, description, list ID, and other optional parameters. Facilitates task addition and project management within Trello.
|
||||
zh_Hans: 用指定的详情(如名称、描述、列表 ID 和其他可选参数)在 Trello 看板上创建一个新卡片。便于在 Trello 中添加任务和管理项目。
|
||||
pt_BR: Cria um novo cartão em um quadro Trello com detalhes especificados, como nome, descrição, ID da lista e outros parâmetros opcionais. Facilita a adição de tarefas e a gestão de projetos dentro do Trello.
|
||||
llm: Initiate a new card on a Trello board by specifying essential details such as the card's name, description, and the list it belongs to, among other settings. Streamlines project task additions and organizational workflows.
|
||||
parameters:
|
||||
- name: name
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Card Name
|
||||
zh_Hans: 卡片名称
|
||||
pt_BR: Nome do Cartão
|
||||
human_description:
|
||||
en_US: The name for the new card. Acts as the primary identifier and summary of the card's purpose.
|
||||
zh_Hans: 新卡片的名称。作为卡片目的的主要标识和总结。
|
||||
pt_BR: O nome para o novo cartão. Funciona como o identificador principal e resumo do propósito do cartão.
|
||||
llm_description: Provide a concise, descriptive name for the card, outlining its main focus or task.
|
||||
form: llm
|
||||
# Include additional parameters like desc, pos, due, idList, etc., following the same pattern.
|
||||
- name: desc
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Card Description
|
||||
zh_Hans: 卡片描述
|
||||
pt_BR: Descrição do Cartão
|
||||
human_description:
|
||||
en_US: Optional. A brief description of the card's purpose or contents.
|
||||
zh_Hans: 可选。卡片目的或内容的简要描述。
|
||||
pt_BR: Opcional. Uma breve descrição do propósito ou conteúdo do cartão.
|
||||
llm_description: Add a brief description to the card to provide context or additional information about its purpose.
|
||||
form: llm
|
||||
- name: pos
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Position
|
||||
zh_Hans: 位置
|
||||
pt_BR: Posição
|
||||
human_description:
|
||||
en_US: Optional. The position of the card in the list. Can be 'top', 'bottom', or a positive number.
|
||||
zh_Hans: 可选。卡片在列表中的位置。可以是“top”、“bottom” 或正数。
|
||||
pt_BR: Opcional. A posição do cartão na lista. Pode ser 'top', 'bottom' ou um número positivo.
|
||||
llm_description: Specify the position of the card within the list, either at the top, bottom, or a specific numerical index.
|
||||
form: llm
|
||||
- name: due
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Due Date
|
||||
zh_Hans: 截止日期
|
||||
pt_BR: Data de Vencimento
|
||||
human_description:
|
||||
en_US: Optional. The due date for the card in the format 'MM/DD/YYYY'.
|
||||
zh_Hans: 可选。卡片的截止日期,格式为“MM/DD/YYYY”。
|
||||
pt_BR: Opcional. A data de vencimento do cartão no formato 'MM/DD/YYYY'.
|
||||
llm_description: Set a due date for the card to establish a deadline for completion or action.
|
||||
form: llm
|
||||
- name: start
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Start Date
|
||||
zh_Hans: 开始日期
|
||||
pt_BR: Data de Início
|
||||
human_description:
|
||||
en_US: Optional. The start date for the card in the format 'MM/DD/YYYY'.
|
||||
zh_Hans: 可选。卡片的开始日期,格式为“MM/DD/YYYY”。
|
||||
pt_BR: Opcional. A data de início do cartão no formato 'MM/DD/YYYY'.
|
||||
llm_description: Specify a start date for the card to mark the beginning of a task or project phase.
|
||||
form: llm
|
||||
- name: dueComplete
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Due Complete
|
||||
zh_Hans: 截止日期已完成
|
||||
pt_BR: Vencimento Concluído
|
||||
human_description:
|
||||
en_US: Optional. Set to true if the due date has been completed, or false if it is pending.
|
||||
zh_Hans: 可选。如果截止日期已完成,则设置为 true;如果尚未完成,则设置为 false。
|
||||
pt_BR: Opcional. Defina como true se a data de vencimento foi concluída, ou como false se estiver pendente.
|
||||
llm_description: Indicate whether the due date for the card has been marked as complete or is still pending.
|
||||
form: llm
|
||||
- name: idList
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: List ID
|
||||
zh_Hans: 列表 ID
|
||||
pt_BR: ID da Lista
|
||||
human_description:
|
||||
en_US: The unique identifier of the list where the card will be added.
|
||||
zh_Hans: 卡片将被添加到的列表的唯一标识符。
|
||||
pt_BR: O identificador único da lista onde o cartão será adicionado.
|
||||
llm_description: Input the ID of the list where the card should be placed, ensuring it is added to the correct list.
|
||||
form: llm
|
||||
- name: idMembers
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Member IDs
|
||||
zh_Hans: 成员 ID
|
||||
pt_BR: IDs de Membros
|
||||
human_description:
|
||||
en_US: Optional. The IDs of members to assign to the card.
|
||||
zh_Hans: 可选。要分配给卡片的成员的 ID。
|
||||
pt_BR: Opcional. Os IDs dos membros a serem atribuídos ao cartão.
|
||||
llm_description: Specify the IDs of members to assign to the card, allowing for task delegation or collaboration.
|
||||
form: llm
|
||||
- name: idLabels
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Label IDs
|
||||
zh_Hans: 标签 ID
|
||||
pt_BR: IDs de Etiquetas
|
||||
human_description:
|
||||
en_US: Optional. The IDs of labels to assign to the card.
|
||||
zh_Hans: 可选。要分配给卡片的标签的 ID。
|
||||
pt_BR: Opcional. Os IDs das etiquetas a serem atribuídos ao cartão.
|
||||
llm_description: Assign specific labels to the card by providing their IDs, aiding in visual categorization or prioritization.
|
||||
form: llm
|
||||
- name: urlSource
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Source URL
|
||||
zh_Hans: 来源 URL
|
||||
pt_BR: URL de Origem
|
||||
human_description:
|
||||
en_US: Optional. The URL to attach as the card's source.
|
||||
zh_Hans: 可选。要附加为卡片来源的 URL。
|
||||
pt_BR: Opcional. O URL a ser anexado como a fonte do cartão.
|
||||
llm_description: Provide a URL to serve as the source reference for the card, linking to external resources or documents.
|
||||
form: llm
|
||||
41
api/core/tools/provider/builtin/trello/tools/delete_board.py
Normal file
41
api/core/tools/provider/builtin/trello/tools/delete_board.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class DeleteBoardTool(BuiltinTool):
|
||||
"""
|
||||
Tool for deleting a Trello board by ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to delete a Trello board by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('boardId')
|
||||
|
||||
if not (api_key and token and board_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.delete(url)
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to delete board")
|
||||
|
||||
return self.create_text_message(text=f"Board with ID {board_id} deleted successfully.")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: delete_board
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Delete Board
|
||||
zh_Hans: 删除看板
|
||||
pt_BR: Excluir Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Deletes a Trello board using its unique ID. This tool allows for the removal of boards that are no longer needed, ensuring a tidy workspace.
|
||||
zh_Hans: 使用其唯一 ID 删除 Trello 看板。此工具允许删除不再需要的看板,确保工作区整洁。
|
||||
pt_BR: Exclui um quadro Trello usando seu ID único. Esta ferramenta permite a remoção de quadros que não são mais necessários, garantindo um espaço de trabalho organizado.
|
||||
llm: Remove a Trello board by specifying its ID. This functionality is helpful for cleaning up unnecessary boards from your Trello account.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier for the Trello board you wish to delete. This ensures the specific board is accurately targeted for deletion.
|
||||
zh_Hans: 您希望删除的 Trello 看板的唯一标识符。这确保了准确地针对特定看板进行删除。
|
||||
pt_BR: O identificador único para o quadro Trello que você deseja excluir. Isso garante que o quadro específico seja precisamente direcionado para exclusão.
|
||||
llm_description: Enter the ID of the Trello board you want to remove. This ID is essential to identify the board precisely and perform the deletion.
|
||||
form: llm
|
||||
41
api/core/tools/provider/builtin/trello/tools/delete_card.py
Normal file
41
api/core/tools/provider/builtin/trello/tools/delete_card.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class DeleteCardByIdTool(BuiltinTool):
|
||||
"""
|
||||
Tool for deleting a Trello card by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to delete a Trello card by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the card ID.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
card_id = tool_parameters.get('id')
|
||||
|
||||
if not (api_key and token and card_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or card ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/cards/{card_id}?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.delete(url)
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to delete card")
|
||||
|
||||
return self.create_text_message(text=f"Card with ID {card_id} has been successfully deleted.")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: delete_card_by_id
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Delete Card by ID
|
||||
zh_Hans: 通过 ID 删除卡片
|
||||
pt_BR: Deletar Cartão por ID
|
||||
description:
|
||||
human:
|
||||
en_US: Deletes a Trello card using its unique ID. This tool facilitates the removal of cards that are no longer needed, maintaining an organized board.
|
||||
zh_Hans: 使用其唯一 ID 删除 Trello 卡片。此工具便于删除不再需要的卡片,保持看板的有序。
|
||||
pt_BR: Exclui um cartão Trello usando seu ID único. Esta ferramenta facilita a remoção de cartões que não são mais necessários, mantendo um quadro organizado.
|
||||
llm: Remove a specific Trello card by providing its ID. Ideal for cleaning up and organizing your Trello boards by eliminating unwanted cards.
|
||||
parameters:
|
||||
- name: id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Card ID
|
||||
zh_Hans: 卡片 ID
|
||||
pt_BR: ID do Cartão
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello card you wish to delete. This ensures the precise card is removed.
|
||||
zh_Hans: 您希望删除的 Trello 卡片的唯一标识符。这确保了精确移除特定卡片。
|
||||
pt_BR: O identificador único do cartão Trello que você deseja excluir. Isso garante que o cartão exato seja removido.
|
||||
llm_description: Input the ID of the Trello card targeted for deletion to ensure accurate and specific removal.
|
||||
form: llm
|
||||
@@ -0,0 +1,54 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class FetchAllBoardsTool(BuiltinTool):
|
||||
"""
|
||||
Tool for fetching all boards from Trello.
|
||||
"""
|
||||
|
||||
def _invoke(
|
||||
self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]
|
||||
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
|
||||
"""
|
||||
Invoke the fetch all boards tool.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation.
|
||||
|
||||
Returns:
|
||||
Union[ToolInvokeMessage, List[ToolInvokeMessage]]: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get("trello_api_key")
|
||||
token = self.runtime.credentials.get("trello_api_token")
|
||||
|
||||
if not (api_key and token):
|
||||
return self.create_text_message(
|
||||
"Missing Trello API key or token in credentials."
|
||||
)
|
||||
|
||||
# Including board filter in the request if provided
|
||||
board_filter = tool_parameters.get("boards", "open")
|
||||
url = f"https://api.trello.com/1/members/me/boards?filter={board_filter}&key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status() # Raises stored HTTPError, if one occurred.
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to fetch boards")
|
||||
|
||||
boards = response.json()
|
||||
|
||||
if not boards:
|
||||
return self.create_text_message("No boards found in Trello.")
|
||||
|
||||
# Creating a string with both board names and IDs
|
||||
boards_info = ", ".join(
|
||||
[f"{board['name']} (ID: {board['id']})" for board in boards]
|
||||
)
|
||||
return self.create_text_message(text=f"Boards: {boards_info}")
|
||||
@@ -0,0 +1,28 @@
|
||||
identity:
|
||||
name: fetch_all_boards
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Fetch All Boards
|
||||
zh_Hans: 获取所有看板
|
||||
pt_BR: Buscar Todos os Quadros
|
||||
description:
|
||||
human:
|
||||
en_US: Retrieves all the Trello boards associated with the user's account. This tool provides a quick overview of all open boards, aiding in efficient project management and organization.
|
||||
zh_Hans: 检索与用户账户关联的所有 Trello 看板。该工具提供了所有打开的看板的快速概览,有助于高效的项目管理和组织。
|
||||
pt_BR: Recupera todos os quadros do Trello associados à conta do usuário. Esta ferramenta oferece uma visão geral rápida de todos os quadros abertos, auxiliando na gestão e organização eficiente do projeto.
|
||||
llm: This tool fetches all Trello boards linked to the user's account, offering a swift snapshot of open boards to streamline project management and organization tasks.
|
||||
parameters:
|
||||
- name: boards
|
||||
type: string
|
||||
required: false
|
||||
default: open
|
||||
label:
|
||||
en_US: Boards filter
|
||||
zh_Hans: 看板过滤器
|
||||
pt_BR: Filtro de quadros
|
||||
human_description:
|
||||
en_US: Specifies the type of boards to retrieve. Default is 'open', fetching all open boards. Other options include 'closed', 'members', 'organization', etc.
|
||||
zh_Hans: 指定要检索的看板类型。默认为“open”,获取所有打开的看板。其他选项包括“closed”,“members”,“organization”等。
|
||||
pt_BR: Especifica o tipo de quadros a serem recuperados. O padrão é 'open', buscando todos os quadros abertos. Outras opções incluem 'closed', 'members', 'organization', etc.
|
||||
llm_description: Determines the category of boards to be displayed, with 'open' as the default setting to show all open boards. Variants like 'closed', 'members', and 'organization' are also selectable.
|
||||
form: llm
|
||||
@@ -0,0 +1,43 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class GetBoardActionsTool(BuiltinTool):
|
||||
"""
|
||||
Tool for retrieving actions for a Trello board by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to retrieve actions for a Trello board by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('boardId')
|
||||
|
||||
if not (api_key and token and board_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}/actions?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
actions = response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to retrieve board actions")
|
||||
|
||||
actions_summary = "\n".join([f"{action['type']}: {action.get('data', {}).get('text', 'No details available')}" for action in actions])
|
||||
return self.create_text_message(text=f"Actions for Board ID {board_id}:\n{actions_summary}")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: get_board_actions
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Get Board Actions
|
||||
zh_Hans: 获取看板操作
|
||||
pt_BR: Obter Ações do Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Retrieves a list of actions (such as updates, movements, and comments) for a Trello board by its ID. This tool provides insights into the board's activity history.
|
||||
zh_Hans: 通过其 ID 为 Trello 看板检索操作列表(如更新、移动和评论)。此工具提供了看板活动历史的见解。
|
||||
pt_BR: Recupera uma lista de ações (como atualizações, movimentos e comentários) para um quadro Trello pelo seu ID. Esta ferramenta oferece insights sobre o histórico de atividades do quadro.
|
||||
llm: Fetch the sequence of actions performed on a Trello board, such as card updates, movements, and comments, by providing the board's ID. Offers a historical view of board activities.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello board for which you want to retrieve actions. It targets the specific board to fetch its activity log.
|
||||
zh_Hans: 您想要检索操作的 Trello 看板的唯一标识符。它定位特定的看板以获取其活动日志。
|
||||
pt_BR: O identificador único do quadro Trello para o qual você deseja recuperar ações. Direciona especificamente para o quadro para buscar seu registro de atividades.
|
||||
llm_description: Input the ID of the Trello board to access its detailed action history, including all updates, comments, and movements related to the board.
|
||||
form: llm
|
||||
@@ -0,0 +1,66 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class GetBoardByIdTool(BuiltinTool):
|
||||
"""
|
||||
Tool for retrieving detailed information about a Trello board by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to retrieve a Trello board by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('boardId')
|
||||
|
||||
if not (api_key and token and board_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
board = response.json()
|
||||
board_details = self.format_board_details(board)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to retrieve board")
|
||||
|
||||
return self.create_text_message(text=board_details)
|
||||
|
||||
def format_board_details(self, board: dict) -> str:
|
||||
"""
|
||||
Format the board details into a human-readable string.
|
||||
|
||||
Args:
|
||||
board (dict): The board information as a dictionary.
|
||||
|
||||
Returns:
|
||||
str: Formatted board details.
|
||||
"""
|
||||
details = (
|
||||
f"Board Name: {board['name']}\n"
|
||||
f"Board ID: {board['id']}\n"
|
||||
f"Description: {board['desc'] or 'No description provided.'}\n"
|
||||
f"Status: {'Closed' if board['closed'] else 'Open'}\n"
|
||||
f"Organization ID: {board['idOrganization'] or 'Not part of an organization.'}\n"
|
||||
f"URL: {board['url']}\n"
|
||||
f"Short URL: {board['shortUrl']}\n"
|
||||
f"Permission Level: {board['prefs']['permissionLevel']}\n"
|
||||
f"Background Color: {board['prefs']['backgroundColor']}"
|
||||
)
|
||||
return details
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: get_board_by_id
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Get Board by ID
|
||||
zh_Hans: 通过 ID 获取看板
|
||||
pt_BR: Obter Quadro por ID
|
||||
description:
|
||||
human:
|
||||
en_US: Retrieves detailed information about a specific Trello board using its unique ID. This tool enables users to quickly access board details without navigating through the Trello interface.
|
||||
zh_Hans: 使用其唯一 ID 检索有关特定 Trello 看板的详细信息。此工具使用户能够快速访问看板详情,无需通过 Trello 界面导航。
|
||||
pt_BR: Recupera informações detalhadas sobre um quadro Trello específico usando seu ID único. Esta ferramenta permite que os usuários acessem rapidamente os detalhes do quadro sem navegar pela interface do Trello.
|
||||
llm: Access details of a Trello board by providing its ID. This tool offers a direct way to view board information, simplifying the process of managing and reviewing Trello boards.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier for the Trello board you wish to retrieve. This ID enables precise targeting and fetching of the board's details.
|
||||
zh_Hans: 您希望检索的 Trello 看板的唯一标识符。此 ID 使能够准确定位和获取看板的详细信息。
|
||||
pt_BR: O identificador único do quadro Trello que você deseja recuperar. Este ID permite o direcionamento preciso e a obtenção dos detalhes do quadro.
|
||||
llm_description: Input the ID of the Trello board to get its details. This unique ID ensures accurate retrieval of information about the specified board.
|
||||
form: llm
|
||||
@@ -0,0 +1,43 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class GetBoardCardsTool(BuiltinTool):
|
||||
"""
|
||||
Tool for retrieving cards on a Trello board by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to retrieve cards on a Trello board by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('boardId')
|
||||
|
||||
if not (api_key and token and board_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}/cards?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
cards = response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to retrieve board cards")
|
||||
|
||||
cards_summary = "\n".join([f"{card['name']} (ID: {card['id']})" for card in cards])
|
||||
return self.create_text_message(text=f"Cards for Board ID {board_id}:\n{cards_summary}")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: get_board_cards
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Get Board Cards
|
||||
zh_Hans: 获取看板卡片
|
||||
pt_BR: Obter Cartões do Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Retrieves all cards present on a specific Trello board by its ID, providing a list of card names and their IDs. Useful for managing and organizing project tasks.
|
||||
zh_Hans: 通过其 ID 检索特定 Trello 看板上的所有卡片,提供卡片名称及其 ID 的列表。用于管理和组织项目任务。
|
||||
pt_BR: Recupera todos os cartões presentes em um quadro Trello específico pelo seu ID, fornecendo uma lista dos nomes dos cartões e seus IDs. Útil para gerenciar e organizar tarefas de projetos.
|
||||
llm: Obtain a list of all cards on a specific Trello board by entering the board's ID. This tool helps in quickly assessing the tasks or items associated with the board.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello board from which you want to retrieve cards. It specifies the exact board to gather card details from.
|
||||
zh_Hans: 您想要从中检索卡片的 Trello 看板的唯一标识符。它指定了要从中收集卡片详细信息的确切看板。
|
||||
pt_BR: O identificador único do quadro Trello do qual você deseja recuperar os cartões. Especifica o quadro exato para obter detalhes dos cartões.
|
||||
llm_description: Input the ID of the Trello board to fetch its cards, allowing for a detailed overview of the board's contents.
|
||||
form: llm
|
||||
@@ -0,0 +1,44 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class GetFilteredBoardCardsTool(BuiltinTool):
|
||||
"""
|
||||
Tool for retrieving filtered cards on a Trello board by its ID and a specified filter.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to retrieve filtered cards on a Trello board by its ID and filter.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID and filter.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('boardId')
|
||||
filter = tool_parameters.get('filter')
|
||||
|
||||
if not (api_key and token and board_id and filter):
|
||||
return self.create_text_message("Missing required parameters: API key, token, board ID, or filter.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}/cards/{filter}?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
filtered_cards = response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to retrieve filtered cards")
|
||||
|
||||
card_details = "\n".join([f"{card['name']} (ID: {card['id']})" for card in filtered_cards])
|
||||
return self.create_text_message(text=f"Filtered Cards for Board ID {board_id} with Filter '{filter}':\n{card_details}")
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
identity:
|
||||
name: get_filtered_board_cards
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Get Filtered Board Cards
|
||||
zh_Hans: 获取筛选的看板卡片
|
||||
pt_BR: Obter Cartões Filtrados do Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Retrieves cards from a Trello board using a specified filter and the board's ID. Filters include options like 'all', 'open', 'closed', 'none', and 'visible', allowing for tailored views of board content.
|
||||
zh_Hans: 使用指定的过滤器和看板的 ID 从 Trello 看板检索卡片。过滤器包括 'all', 'open', 'closed', 'none' 和 'visible' 等选项,允许对看板内容进行定制查看。
|
||||
pt_BR: Recupera cartões de um quadro Trello usando um filtro especificado e o ID do quadro. Os filtros incluem opções como 'all', 'open', 'closed', 'none' e 'visible', permitindo visualizações personalizadas do conteúdo do quadro.
|
||||
llm: Access cards on a Trello board through specific filters such as 'all', 'open', 'closed', 'none', and 'visible' by providing the board's ID. This feature enables focused examination of the board's cards.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier for the Trello board from which to retrieve the filtered cards.
|
||||
zh_Hans: 用于检索筛选卡片的 Trello 看板的唯一标识符。
|
||||
pt_BR: O identificador único do quadro Trello do qual os cartões filtrados serão recuperados.
|
||||
llm_description: Enter the Trello board's ID to specify from which board to fetch the cards using the filter.
|
||||
form: llm
|
||||
- name: filter
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Filter
|
||||
zh_Hans: 过滤器
|
||||
pt_BR: Filtro
|
||||
human_description:
|
||||
en_US: The filter to apply when retrieving cards. Valid values are 'all', 'open', 'closed', 'none', and 'visible'.
|
||||
zh_Hans: 检索卡片时应用的过滤器。有效值为 'all', 'open', 'closed', 'none', 和 'visible'。
|
||||
pt_BR: O filtro a ser aplicado ao recuperar cartões. Os valores válidos são 'all', 'open', 'closed', 'none' e 'visible'.
|
||||
llm_description: Specify the filter for card retrieval. Choose from 'all', 'open', 'closed', 'none', or 'visible' to control which cards are fetched.
|
||||
form: llm
|
||||
@@ -0,0 +1,43 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class GetListsFromBoardTool(BuiltinTool):
|
||||
"""
|
||||
Tool for retrieving all lists from a specified Trello board by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to get all lists from a specified Trello board.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool]]): The parameters for the tool invocation, including the board ID.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.get('boardId')
|
||||
|
||||
if not (api_key and token and board_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}/lists?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
lists = response.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to retrieve lists")
|
||||
|
||||
lists_info = "\n".join([f"{list['name']} (ID: {list['id']})" for list in lists])
|
||||
return self.create_text_message(text=f"Lists on Board ID {board_id}:\n{lists_info}")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
identity:
|
||||
name: get_lists_from_board
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Get Lists from Board
|
||||
zh_Hans: 获取看板的列表
|
||||
pt_BR: Obter Listas do Quadro
|
||||
description:
|
||||
human:
|
||||
en_US: Retrieves all lists from a specified Trello board by its ID, providing an overview of the board's organization and current phases or categories.
|
||||
zh_Hans: 通过其 ID 从指定的 Trello 看板检索所有列表,提供看板组织和当前阶段或类别的概览。
|
||||
pt_BR: Recupera todas as listas de um quadro Trello especificado pelo seu ID, fornecendo uma visão geral da organização do quadro e das fases ou categorias atuais.
|
||||
llm: Fetch and display all lists from a specific Trello board by inputting the board's ID. This aids in understanding the board's structure and task categorization.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello board from which to retrieve the lists.
|
||||
zh_Hans: 用于检索列表的 Trello 看板的唯一标识符。
|
||||
pt_BR: O identificador único do quadro Trello do qual as listas serão recuperadas.
|
||||
llm_description: Enter the ID of the Trello board to obtain a detailed list of all its lists, providing insight into the board's structure.
|
||||
form: llm
|
||||
47
api/core/tools/provider/builtin/trello/tools/update_board.py
Normal file
47
api/core/tools/provider/builtin/trello/tools/update_board.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class UpdateBoardByIdTool(BuiltinTool):
|
||||
"""
|
||||
Tool for updating a Trello board by its ID with various parameters.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool, None]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to update a Trello board by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool, None]]): The parameters for the tool invocation, including board ID and updates.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
board_id = tool_parameters.pop('boardId', None)
|
||||
|
||||
if not (api_key and token and board_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or board ID.")
|
||||
|
||||
url = f"https://api.trello.com/1/boards/{board_id}"
|
||||
|
||||
# Removing parameters not intended for update action or with None value
|
||||
params = {k: v for k, v in tool_parameters.items() if v is not None}
|
||||
params['key'] = api_key
|
||||
params['token'] = token
|
||||
|
||||
try:
|
||||
response = requests.put(url, params=params)
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to update board")
|
||||
|
||||
updated_board = response.json()
|
||||
return self.create_text_message(text=f"Board '{updated_board['name']}' updated successfully.")
|
||||
|
||||
157
api/core/tools/provider/builtin/trello/tools/update_board.yaml
Normal file
157
api/core/tools/provider/builtin/trello/tools/update_board.yaml
Normal file
@@ -0,0 +1,157 @@
|
||||
identity:
|
||||
name: update_board_by_id
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Update Board by ID
|
||||
zh_Hans: 通过 ID 更新看板
|
||||
pt_BR: Atualizar Quadro por ID
|
||||
description:
|
||||
human:
|
||||
en_US: Updates a Trello board's settings based on the provided ID and parameters. Allows for changing the board's name, description, status, and other preferences.
|
||||
zh_Hans: 根据提供的 ID 和参数更新 Trello 看板的设置。允许更改看板的名称、描述、状态和其他偏好设置。
|
||||
pt_BR: Atualiza as configurações de um quadro Trello com base no ID fornecido e nos parâmetros. Permite alterar o nome, descrição, status e outras preferências do quadro.
|
||||
llm: Modify a Trello board's attributes like its name, description, and visibility settings using the board's ID. This tool streamlines board customization and management.
|
||||
parameters:
|
||||
- name: boardId
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello board you want to update. Ensures targeted and precise updates.
|
||||
zh_Hans: 您要更新的 Trello 看板的唯一标识符。确保目标准确和更新精确。
|
||||
pt_BR: O identificador único do quadro Trello que você deseja atualizar. Garante atualizações direcionadas e precisas.
|
||||
llm_description: Provide the specific ID of the Trello board you aim to update to ensure accuracy in modification process.
|
||||
form: llm
|
||||
- name: name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Board Name
|
||||
zh_Hans: 看板名称
|
||||
pt_BR: Nome do Quadro
|
||||
human_description:
|
||||
en_US: Optional. The new name for the board.
|
||||
zh_Hans: 可选。看板的新名称。
|
||||
pt_BR: Opcional. O novo nome para o quadro.
|
||||
llm_description: Enter a new name for the board if you wish to change it; this name identifies the board in Trello.
|
||||
form: llm
|
||||
- name: desc
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Board Description
|
||||
zh_Hans: 看板描述
|
||||
pt_BR: Descrição do Quadro
|
||||
human_description:
|
||||
en_US: Optional. The new description for the board.
|
||||
zh_Hans: 可选。看板的新描述。
|
||||
pt_BR: Opcional. A nova descrição para o quadro.
|
||||
llm_description: Provide a new description for the board if you wish to update it; this description provides additional context about the board.
|
||||
form: llm
|
||||
- name: closed
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Closed
|
||||
zh_Hans: 已关闭
|
||||
pt_BR: Fechado
|
||||
human_description:
|
||||
en_US: Optional. Set to true to close the board, or false to keep it open.
|
||||
zh_Hans: 可选。设置为 true 以关闭看板,或设置为 false 以保持打开。
|
||||
pt_BR: Opcional. Defina como true para fechar o quadro ou como false para mantê-lo aberto.
|
||||
llm_description: Specify whether the board should be closed or kept open by setting this parameter to true or false.
|
||||
form: llm
|
||||
- name: subscribed
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Subscribed
|
||||
zh_Hans: 订阅
|
||||
pt_BR: Inscrito
|
||||
human_description:
|
||||
en_US: Optional. Set to true to subscribe to the board, or false to unsubscribe.
|
||||
zh_Hans: 可选。设置为 true 以订阅看板,或设置为 false 以取消订阅。
|
||||
pt_BR: Opcional. Defina como true para se inscrever no quadro ou como false para cancelar a inscrição.
|
||||
llm_description: Choose to subscribe or unsubscribe from the board by setting this parameter to true or false.
|
||||
form: llm
|
||||
- name: idOrganization
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Organization ID
|
||||
zh_Hans: 组织 ID
|
||||
pt_BR: ID da Organização
|
||||
human_description:
|
||||
en_US: Optional. The ID of the organization to which the board belongs.
|
||||
zh_Hans: 可选。看板所属组织的 ID。
|
||||
pt_BR: Opcional. O ID da organização à qual o quadro pertence.
|
||||
llm_description: Input the ID of the organization to which the board is associated, if applicable.
|
||||
form: llm
|
||||
- name: prefs_permissionLevel
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Permission Level
|
||||
zh_Hans: 权限级别
|
||||
pt_BR: Nível de Permissão
|
||||
human_description:
|
||||
en_US: Optional. The permission level for the board. Valid values are 'private', 'org', or 'public'.
|
||||
zh_Hans: 可选。看板的权限级别。有效值为 'private'、'org' 或 'public'。
|
||||
pt_BR: Opcional. O nível de permissão para o quadro. Os valores válidos são 'private', 'org' ou 'public'.
|
||||
llm_description: Specify the permission level for the board by choosing from 'private', 'org', or 'public'.
|
||||
form: llm
|
||||
- name: prefs_selfJoin
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Allow Self-Join
|
||||
zh_Hans: 允许自行加入
|
||||
pt_BR: Permitir Auto-Inscrição
|
||||
human_description:
|
||||
en_US: Optional. Set to true to allow members to join the board without an invitation, or false to require an invitation.
|
||||
zh_Hans: 可选。设置为 true 以允许成员加入看板而无需邀请,或设置为 false 以要求邀请。
|
||||
pt_BR: Opcional. Defina como true para permitir que os membros se inscrevam no quadro sem um convite, ou como false para exigir um convite.
|
||||
llm_description: Choose whether to allow members to join the board without an invitation by setting this parameter to true or false.
|
||||
form: llm
|
||||
- name: prefs_cardCovers
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Card Covers
|
||||
zh_Hans: 卡片封面
|
||||
pt_BR: Capas de Cartão
|
||||
human_description:
|
||||
en_US: Optional. Set to true to enable card covers, or false to disable them.
|
||||
zh_Hans: 可选。设置为 true 以启用卡片封面,或设置为 false 以禁用卡片封面。
|
||||
pt_BR: Opcional. Defina como true para habilitar capas de cartão ou como false para desabilitá-las.
|
||||
llm_description: Enable or disable card covers by setting this parameter to true or false.
|
||||
form: llm
|
||||
- name: prefs_hideVotes
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Hide Votes
|
||||
zh_Hans: 隐藏投票
|
||||
pt_BR: Ocultar Votos
|
||||
human_description:
|
||||
en_US: Optional. Set to true to hide votes, or false to show them.
|
||||
zh_Hans: 可选。设置为 true 以隐藏投票,或设置为 false 以显示投票。
|
||||
pt_BR: Opcional. Defina como true para ocultar votos ou como false para mostrá-los.
|
||||
llm_description: Choose to hide or show votes by setting this parameter to true or false.
|
||||
form: llm
|
||||
- name: prefs_invitations
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Invitations
|
||||
zh_Hans: 邀请
|
||||
pt_BR: Convites
|
||||
human_description:
|
||||
en_US: Optional. Set to 'members' to allow only board members to send invitations, or 'admins' to allow admins to send invitations.
|
||||
zh_Hans: 可选。设置为 'members' 以仅允许看板成员发送邀请,或设置为 'admins' 以允许管理员发送邀请。
|
||||
pt_BR: Opcional. Defina como 'members' para permitir que apenas membros do quadro enviem convites, ou 'admins' para permitir que os administradores enviem convites.
|
||||
llm_description: Choose who can send invitations by setting this parameter to 'members' or 'admins'.
|
||||
form: llm
|
||||
44
api/core/tools/provider/builtin/trello/tools/update_card.py
Normal file
44
api/core/tools/provider/builtin/trello/tools/update_card.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
|
||||
|
||||
class UpdateCardByIdTool(BuiltinTool):
|
||||
"""
|
||||
Tool for updating a Trello card by its ID.
|
||||
"""
|
||||
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Union[str, int, bool, None]]) -> ToolInvokeMessage:
|
||||
"""
|
||||
Invoke the tool to update a Trello card by its ID.
|
||||
|
||||
Args:
|
||||
user_id (str): The ID of the user invoking the tool.
|
||||
tool_parameters (dict[str, Union[str, int, bool, None]]): The parameters for the tool invocation, including the card ID and updates.
|
||||
|
||||
Returns:
|
||||
ToolInvokeMessage: The result of the tool invocation.
|
||||
"""
|
||||
api_key = self.runtime.credentials.get('trello_api_key')
|
||||
token = self.runtime.credentials.get('trello_api_token')
|
||||
card_id = tool_parameters.get('id')
|
||||
|
||||
if not (api_key and token and card_id):
|
||||
return self.create_text_message("Missing required parameters: API key, token, or card ID.")
|
||||
|
||||
# Constructing the URL and the payload for the PUT request
|
||||
url = f"https://api.trello.com/1/cards/{card_id}"
|
||||
params = {k: v for k, v in tool_parameters.items() if v is not None and k != 'id'}
|
||||
params.update({'key': api_key, 'token': token})
|
||||
|
||||
try:
|
||||
response = requests.put(url, params=params)
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return self.create_text_message("Failed to update card")
|
||||
|
||||
updated_card_info = f"Card '{card_id}' updated successfully."
|
||||
return self.create_text_message(text=updated_card_info)
|
||||
@@ -0,0 +1,81 @@
|
||||
identity:
|
||||
name: update_card_by_id
|
||||
author: Yash Parmar
|
||||
label:
|
||||
en_US: Update Card by ID
|
||||
zh_Hans: 通过 ID 更新卡片
|
||||
pt_BR: Atualizar Cartão por ID
|
||||
description:
|
||||
human:
|
||||
en_US: Updates specified attributes of a Trello card, such as its name, description, list ID, and board ID, by providing the card's unique ID.
|
||||
zh_Hans: 通过提供卡片的唯一 ID,更新 Trello 卡片的特定属性,如其名称、描述、列表 ID 和看板 ID。
|
||||
pt_BR: Atualiza atributos específicos de um cartão Trello, como seu nome, descrição, ID da lista e ID do quadro, fornecendo o ID único do cartão.
|
||||
llm: Modify a Trello card's key details, including name, description, and its placement on the board, by using the card's ID. Enables precise and targeted updates to card information.
|
||||
parameters:
|
||||
- name: id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Card ID
|
||||
zh_Hans: 卡片 ID
|
||||
pt_BR: ID do Cartão
|
||||
human_description:
|
||||
en_US: The unique identifier of the Trello card you intend to update.
|
||||
zh_Hans: 您打算更新的 Trello 卡片的唯一标识符。
|
||||
pt_BR: O identificador único do cartão Trello que você pretende atualizar.
|
||||
llm_description: Input the ID of the Trello card to be updated to ensure the correct card is targeted.
|
||||
form: llm
|
||||
# Include other parameters following the same pattern
|
||||
- name: name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: New Name
|
||||
zh_Hans: 新名称
|
||||
pt_BR: Novo Nome
|
||||
human_description:
|
||||
en_US: Optional. The new name to assign to the card.
|
||||
zh_Hans: 可选。要分配给卡片的新名称。
|
||||
pt_BR: Opcional. O novo nome a ser atribuído ao cartão.
|
||||
llm_description: Specify a new name for the card if changing it. This name is what will be displayed on the Trello board.
|
||||
form: llm
|
||||
# Add definitions for desc, idList and idBoard parameters
|
||||
- name: desc
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: New Description
|
||||
zh_Hans: 新描述
|
||||
pt_BR: Nova Descrição
|
||||
human_description:
|
||||
en_US: Optional. The new description to assign to the card.
|
||||
zh_Hans: 可选。要分配给卡片的新描述。
|
||||
pt_BR: Opcional. A nova descrição a ser atribuída ao cartão.
|
||||
llm_description: Provide a new description for the card if you wish to update it; this description provides additional context about the card.
|
||||
form: llm
|
||||
- name: idList
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: List ID
|
||||
zh_Hans: 列表 ID
|
||||
pt_BR: ID da Lista
|
||||
human_description:
|
||||
en_US: Optional. The ID of the list to which the card should be moved.
|
||||
zh_Hans: 可选。卡片应移动到的列表的 ID。
|
||||
pt_BR: Opcional. O ID da lista para a qual o cartão deve ser movido.
|
||||
llm_description: Enter the ID of the list where you want to move the card. This action relocates the card to the specified list.
|
||||
form: llm
|
||||
- name: idBoard
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Board ID
|
||||
zh_Hans: 看板 ID
|
||||
pt_BR: ID do Quadro
|
||||
human_description:
|
||||
en_US: Optional. The ID of the board to which the card should be moved.
|
||||
zh_Hans: 可选。卡片应移动到的看板的 ID。
|
||||
pt_BR: Opcional. O ID do quadro para o qual o cartão deve ser movido.
|
||||
llm_description: Provide the ID of the board where you want to move the card. This action relocates the card to the specified board.
|
||||
form: llm
|
||||
34
api/core/tools/provider/builtin/trello/trello.py
Normal file
34
api/core/tools/provider/builtin/trello/trello.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
|
||||
from core.tools.errors import ToolProviderCredentialValidationError
|
||||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
|
||||
|
||||
class TrelloProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict[str, Any]) -> None:
|
||||
"""Validate Trello API credentials by making a test API call.
|
||||
|
||||
Args:
|
||||
credentials (dict[str, Any]): The Trello API credentials to validate.
|
||||
|
||||
Raises:
|
||||
ToolProviderCredentialValidationError: If the credentials are invalid.
|
||||
"""
|
||||
api_key = credentials.get("trello_api_key")
|
||||
token = credentials.get("trello_api_token")
|
||||
url = f"https://api.trello.com/1/members/me?key={api_key}&token={token}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status() # Raises an HTTPError for bad responses
|
||||
except requests.exceptions.HTTPError as e:
|
||||
if response.status_code == 401:
|
||||
# Unauthorized, indicating invalid credentials
|
||||
raise ToolProviderCredentialValidationError("Invalid Trello credentials: Unauthorized.")
|
||||
# Handle other potential HTTP errors
|
||||
raise ToolProviderCredentialValidationError("Error validating Trello credentials")
|
||||
except requests.exceptions.RequestException as e:
|
||||
# Handle other exceptions, such as connection errors
|
||||
raise ToolProviderCredentialValidationError("Error validating Trello credentials")
|
||||
45
api/core/tools/provider/builtin/trello/trello.yaml
Normal file
45
api/core/tools/provider/builtin/trello/trello.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
identity:
|
||||
author: Yash Parmar
|
||||
name: trello
|
||||
label:
|
||||
en_US: Trello
|
||||
zh_Hans: Trello
|
||||
pt_BR: Trello
|
||||
description:
|
||||
en_US: "Trello: A visual tool for organizing your work and life."
|
||||
zh_Hans: "Trello: 一个用于组织工作和生活的视觉工具。"
|
||||
pt_BR: "Trello: Uma ferramenta visual para organizar seu trabalho e vida."
|
||||
icon: icon.svg
|
||||
credentials_for_provider:
|
||||
trello_api_key:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: Trello API key
|
||||
zh_Hans: Trello API key
|
||||
pt_BR: Trello API key
|
||||
placeholder:
|
||||
en_US: Enter your Trello API key
|
||||
zh_Hans: 输入您的 Trello API key
|
||||
pt_BR: Insira sua chave API do Trello
|
||||
help:
|
||||
en_US: Obtain your API key from Trello's website.
|
||||
zh_Hans: 从 Trello 网站获取您的 API key。
|
||||
pt_BR: Obtenha sua chave API no site do Trello.
|
||||
url: https://developer.atlassian.com/cloud/trello/guides/rest-api/api-introduction/
|
||||
trello_api_token:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: Trello API token
|
||||
zh_Hans: Trello API token
|
||||
pt_BR: Trello API token
|
||||
placeholder:
|
||||
en_US: Enter your Trello API token
|
||||
zh_Hans: 输入您的 Trello API token
|
||||
pt_BR: Insira seu token API do Trello
|
||||
help:
|
||||
en_US: Secure your API token from Trello's website.
|
||||
zh_Hans: 从 Trello 网站获取您的 API token。
|
||||
pt_BR: Garanta seu token API no site do Trello.
|
||||
url: https://developer.atlassian.com/cloud/trello/guides/rest-api/api-introduction/
|
||||
Reference in New Issue
Block a user