Files
openclaw/src/tools/protocol.ts
2026-05-02 07:38:59 +01:00

23 lines
691 B
TypeScript

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);
}