mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:50:43 +00:00
refactor: tighten tool schema types
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Type } from "typebox";
|
||||
import { Type, type TSchema } from "typebox";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
cleanToolSchemaForGemini,
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
normalizeToolParameters,
|
||||
} from "./pi-tools.schema.js";
|
||||
import type { AnyAgentTool } from "./pi-tools.types.js";
|
||||
import { asToolParameterSchema } from "./tools/common.js";
|
||||
|
||||
describe("normalizeToolParameterSchema", () => {
|
||||
it("normalizes truly empty schemas to type:object with properties:{}", () => {
|
||||
@@ -108,12 +107,12 @@ describe("normalizeToolParameterSchema", () => {
|
||||
});
|
||||
});
|
||||
|
||||
function makeTool(parameters: unknown): AnyAgentTool {
|
||||
function makeTool(parameters: TSchema): AnyAgentTool {
|
||||
return {
|
||||
name: "test_tool",
|
||||
label: "Test Tool",
|
||||
description: "test",
|
||||
parameters: asToolParameterSchema(parameters),
|
||||
parameters,
|
||||
execute: vi.fn(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user