refactor: tighten tool schema types

This commit is contained in:
Peter Steinberger
2026-04-23 05:06:45 +01:00
parent 675cf823fd
commit 33aea44fe5
11 changed files with 36 additions and 37 deletions

View File

@@ -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(),
};
}