fix(api): add resultSchema field to ToolDef interface
CI / Architecture Guardrails (push) Successful in 1m12s
CI / Typecheck (push) Failing after 1m41s
CI / Build (push) Has been skipped
CI / E2E Tests (push) Has been skipped
CI / Fresh-Linux Docker Deploy (push) Has been skipped
CI / Release Images (push) Has been cancelled
CI / Assistant Split Regression (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled

Committed assistant-tools.ts already references toolDefinition?.resultSchema
for EGAI 4.3.1.2 result validation, but the ToolDef interface in shared.ts
was missing the field declaration, breaking typecheck.
This commit is contained in:
2026-04-12 18:17:42 +02:00
parent b9c2e0cd2e
commit a9a580b8f5
@@ -1,5 +1,6 @@
import type { prisma } from "@capakraken/db";
import type { PermissionKey, SystemRole } from "@capakraken/shared";
import type { z } from "zod";
import type { TRPCContext } from "../../trpc.js";
export type ToolContext = {
@@ -29,6 +30,8 @@ export interface ToolDef {
parameters: Record<string, unknown>;
};
access?: ToolAccessRequirements;
/** EGAI 4.3.1.2 — optional Zod schema to validate tool results before returning to the AI */
resultSchema?: z.ZodType;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -40,8 +43,6 @@ export function withToolAccess(
): ToolDef[] {
return tools.map((tool) => ({
...tool,
...(accessByName[tool.function.name]
? { access: accessByName[tool.function.name] }
: {}),
...(accessByName[tool.function.name] ? { access: accessByName[tool.function.name] } : {}),
}));
}