Type Alias: InferToolResult<T>
InferToolResult<
T> =Textendsobject?Awaited<R> :never
Defined in: packages/core/src/type-utils.ts:151
Infer the return type from a tool definition Handles both sync and async functions
Type Parameters
T
T
Example
const tool = defineZodTool({
schema: z.object({ x: z.number() }),
function: async (params) => ({ result: params.x * 2 })
});
type Result = InferToolResult<typeof tool>; // { result: number }