donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
34 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolsApi = void 0;
const v4_1 = require("zod/v4");
const toolConstants_1 = require("../tools/toolConstants");
/**
* This class reports the tools supported by the Donobu runtime.
*/
class ToolsApi {
constructor(toolRegistry) {
this.toolRegistry = toolRegistry;
}
/**
* GET endpoint handler that returns the supported tools as JSON
*/
async getSupportedTools(req, res) {
const targetType = req.query.target;
const tools = targetType
? this.toolRegistry.toolsForTarget(targetType)
: this.toolRegistry.allTools();
const response = tools
.filter((tool) => !toolConstants_1.SUPPRESSED_TOOLS_BY_NAME.has(tool.name))
.map((tool) => ({
name: tool.name,
description: tool.description,
inputSchema: v4_1.z.toJSONSchema(tool.inputSchema),
requiresGpt: tool.requiresGpt,
supportedTargets: tool.supportedTargets,
}));
res.json(response);
}
}
exports.ToolsApi = ToolsApi;
//# sourceMappingURL=ToolsApi.js.map