mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 09:40:43 +00:00
feat: add tool descriptor planner
This commit is contained in:
22
src/tools/protocol.ts
Normal file
22
src/tools/protocol.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { JsonObject, ToolPlanEntry } from "./types.js";
|
||||
|
||||
export type ToolProtocolDescriptor = {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly inputSchema: JsonObject;
|
||||
};
|
||||
|
||||
// Shared descriptor shape only. Model/provider adapters still own schema normalization.
|
||||
export function toToolProtocolDescriptor(entry: ToolPlanEntry): ToolProtocolDescriptor {
|
||||
return {
|
||||
name: entry.descriptor.name,
|
||||
description: entry.descriptor.description,
|
||||
inputSchema: entry.descriptor.inputSchema,
|
||||
};
|
||||
}
|
||||
|
||||
export function toToolProtocolDescriptors(
|
||||
entries: readonly ToolPlanEntry[],
|
||||
): readonly ToolProtocolDescriptor[] {
|
||||
return entries.map(toToolProtocolDescriptor);
|
||||
}
|
||||
Reference in New Issue
Block a user