mirror of
https://github.com/morluto/rea.git
synced 2026-10-28 10:25:42 +00:00
23 lines
819 B
TypeScript
23 lines
819 B
TypeScript
import type { ToolContract } from "../contracts/toolContractTypes.js";
|
|
import {
|
|
toolInputSchemaWithMetadata,
|
|
toolOutputSchemaWithMetadata,
|
|
} from "../contracts/toolSchemaMetadata.js";
|
|
|
|
/** Project the canonical Zod contracts directly into SDK registration. */
|
|
export const toolRegistrationOptions = <Contract extends ToolContract>(
|
|
contract: Contract,
|
|
): {
|
|
readonly title: Contract["title"];
|
|
readonly description: Contract["description"];
|
|
readonly inputSchema: Contract["inputSchema"];
|
|
readonly outputSchema: Contract["outputSchema"];
|
|
readonly annotations: Contract["annotations"];
|
|
} => ({
|
|
title: contract.title,
|
|
description: contract.description,
|
|
inputSchema: toolInputSchemaWithMetadata(contract),
|
|
outputSchema: toolOutputSchemaWithMetadata(contract),
|
|
annotations: contract.annotations,
|
|
});
|