Skip to content

Tools API Tools

API endpoints for tool management and invocation.

List Tools

GET /api/tools

Get all available tools.

Response:

json
{
  "success": true,
  "data": {
    "tools": [
      {
        "name": "get_current_time",
        "description": "Get current time",
        "category": "basic",
        "enabled": true
      }
    ],
    "categories": {
      "basic": { "name": "Basic", "enabled": true },
      "admin": { "name": "Admin", "enabled": false }
    }
  }
}

Get Tool Details

GET /api/tools/:name

Get specific tool information.

Response:

json
{
  "success": true,
  "data": {
    "name": "get_current_time",
    "description": "Get current time and date",
    "category": "basic",
    "inputSchema": {
      "type": "object",
      "properties": {
        "format": { "type": "string" }
      }
    }
  }
}

Toggle Tool

PUT /api/tools/:name/toggle

Enable or disable a tool.

Request:

json
{
  "enabled": true
}

Response:

json
{
  "success": true,
  "data": {
    "name": "get_current_time",
    "enabled": true
  }
}

Toggle Category

PUT /api/tools/category/:category/toggle

Enable or disable entire category.

Request:

json
{
  "enabled": false
}

Get Tool Logs

GET /api/tools/logs

Get recent tool call logs.

Query Parameters:

ParamTypeDescription
limitnumberMax results (default 50)
offsetnumberPagination offset
toolstringFilter by tool name

Response:

json
{
  "success": true,
  "data": {
    "logs": [
      {
        "id": "abc123",
        "tool": "get_current_time",
        "args": {},
        "result": { "time": "14:30" },
        "duration": 15,
        "timestamp": 1702622400000,
        "userId": "123456789",
        "groupId": "987654321"
      }
    ],
    "total": 100
  }
}

Call Tool (Debug)

POST /api/tools/call

Manually call a tool for testing.

Request:

json
{
  "name": "get_current_time",
  "args": {
    "format": "full"
  }
}

Response:

json
{
  "success": true,
  "data": {
    "result": {
      "text": "2024-12-15 14:30:00",
      "timestamp": 1702622400000
    },
    "duration": 12
  }
}

Error Codes

CodeDescription
TOOL_NOT_FOUNDTool doesn't exist
TOOL_DISABLEDTool is disabled
INVALID_ARGSInvalid arguments
EXECUTION_ERRORTool execution failed

Next Steps

Released under the MIT License