Connect Tool Library Skill
Manage HTTP API Credentials (tokens)
Credentials Config
- - Credentials File: INLINECODE0
Workflow
- 1. If this skill's Credentials File is not exists, create it under this skill with followed content:
# HTTP API Credentials
## Example
- KEY_NAME: KEY_STRING
## Key List
- 2. Save to Credentials File with format: INLINECODE1
- Compare existing keys; if the key already exists, remove the old key pair
- Compare existing key names; if the key name already exists, remove the old key pair
Execute Tool Calls
API Configuration
- - Base URL: INLINECODE2
- Authentication: Bearer token
- Token: Retrieve from users prompt
- Request Method: POST for all endpoints
- Content-Type: INLINECODE3
Available Endpoints
Fetch Tool Categories: POST /tool/categories
- - Returns list of all tool categories
- No request body required (send empty JSON
{}) - Response Content-Type: INLINECODE6
Fetch Tool List: POST /tool/list/[CATEGORY_NAME]
- - Returns list of all available tools and tags. the format is :
# Available Tools
## With Parameters
- tool_name: tag
## No Parameters
- tool_name: tag
## Tags
- tag: tag_description
- - No request body required (send empty JSON
{}) - Response Content-Type: INLINECODE9
Obtain Tool Description: POST /tool/description/[TOOL_NAME]
- - Return a specific tool description and input schema
- No request body required (send empty JSON
{}) - Response Content-Type: INLINECODE12
Call Tool: POST /tool/call/[TOOL_NAME]
- - Executes a specific tool with provided parameters
- Request body: JSON object with tool parameters matching the tool's input schema
- Response Content-Type: INLINECODE14
Authentication Setup
if
Credentials File is not exists,
Prompt the user: INLINECODE15
Workflow
- 1. Retrieve API Token from Credentials File
- Check API Token, if the token start with
$ then retrieve the real token from env - Fetch tool categories and select the best-suited one. If no category is selected, use category INLINECODE17
- Fetch tool list and select the one best suited
- If you need to view tool description or input schema, Obtain Tool Description
- Call tool with parameters
Response Format
Successful responses return JSON with
content array containing the result. Error responses include
isError: true and error details in the
content field.
Important Notes
- - Authentication Required: All requests must include the bearer token in the Authorization header
- JSON Format: Request bodies must be valid JSON matching the tool's input schema
- Error Handling: Check
isError field in responses to detect failures
Troubleshooting
- - Authentication Errors: Verify the bearer token is correct
- Tool Not Found: Check tool name spelling and fetch tool list
- Invalid Parameters: Review tool input schema for required fields
技能名称: connect-tool-library
详细描述:
连接工具库技能
管理HTTP API凭证(令牌)
凭证配置
- - 凭证文件: [USER_HOME]/.cogenticlab/credentials.md
工作流程
- 1. 如果此技能的凭证文件不存在,则在该技能下创建它,内容如下:
# HTTP API凭证
## 示例
- KEYNAME: KEYSTRING
## 密钥列表
- 2. 以格式- KEY_NAME: KEY保存到凭证文件
- 比较现有密钥;如果密钥已存在,则移除旧密钥对
- 比较现有密钥名称;如果密钥名称已存在,则移除旧密钥对
执行工具调用
API配置
- - 基础URL: https://link.cogenticlab.io
- 认证方式: Bearer令牌
- 令牌: 从用户提示中获取
- 请求方法: 所有端点均使用POST
- 内容类型: application/json
可用端点
获取工具类别: POST /tool/categories
- - 返回所有工具类别列表
- 无需请求体(发送空JSON {})
- 响应内容类型: application/json
获取工具列表: POST /tool/list/[CATEGORY_NAME]
markdown
# 可用工具
## 带参数
- tool_name: tag
## 无参数
- tool_name: tag
## 标签
- tag: tag_description
- - 无需请求体(发送空JSON {})
- 响应内容类型: text/markdown
获取工具描述: POST /tool/description/[TOOL_NAME]
- - 返回特定工具的描述和输入模式
- 无需请求体(发送空JSON {})
- 响应内容类型: text/markdown
调用工具: POST /tool/call/[TOOL_NAME]
- - 使用提供的参数执行特定工具
- 请求体:包含与工具输入模式匹配的工具参数的JSON对象
- 响应内容类型: application/json
认证设置
如果
凭证文件不存在,
提示用户: 未找到工具库API令牌,请在Cogentic Hub中创建工具库。首先下载并安装Cogentic Hub (https://github.com/cogenticlab/cogentichub/)
工作流程
- 1. 从凭证文件中获取API令牌
- 检查API令牌,如果令牌以$开头,则从环境变量中获取真实令牌
- 获取工具类别并选择最合适的类别。如果未选择类别,则使用所有工具类别
- 获取工具列表并选择最合适的工具
- 如果需要查看工具描述或输入模式,则获取工具描述
- 调用工具并传入参数
响应格式
成功响应返回包含content数组的JSON,其中包含结果。错误响应包含isError: true和content字段中的错误详情。
重要说明
- - 需要认证: 所有请求必须在Authorization头中包含bearer令牌
- JSON格式: 请求体必须是有效的JSON,与工具的输入模式匹配
- 错误处理: 检查响应中的isError字段以检测失败
故障排除
- - 认证错误: 验证bearer令牌是否正确
- 工具未找到: 检查工具名称拼写并获取工具列表
- 无效参数: 查看工具输入模式以了解必填字段