Files
openclaw-plugin-tools/src/index.ts
T

43 lines
1.3 KiB
TypeScript

import { jsonResult } from "openclaw/plugin-sdk/core";
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
import { toolPluginMetadataSymbol } from "openclaw/plugin-sdk/tool-plugin";
import { echoTool } from "./tools/echo.js";
import { buildOpenAIVideoGenerationProvider } from "./video/index.js";
const entry = definePluginEntry({
id: "tools",
name: "Tools",
description: "Custom Tools and Media Providers for OpenClaw.",
register(api) {
api.registerTool({
name: echoTool.name,
label: echoTool.label,
description: echoTool.description,
parameters: echoTool.parameters,
execute: async (_toolCallId, params) => {
const result = await echoTool.execute(params as any);
return jsonResult(result);
},
});
api.registerVideoGenerationProvider(
buildOpenAIVideoGenerationProvider({
isProviderApiKeyConfigured: api.runtime.modelAuth.isProviderApiKeyConfigured,
getPluginConfig: () => api.pluginConfig,
}),
);
},
});
Object.defineProperty(entry, toolPluginMetadataSymbol, {
value: {
id: "tools",
name: "Tools",
description: "Custom Tools and Media Providers for OpenClaw.",
tools: [echoTool],
},
enumerable: false,
});
export default entry;