Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

export-pdf-tool.ts

24 lines804 Bytes

1import { toolDefinition } from '@tanstack/ai'
2import { z } from 'zod'
3​
4/**
5 * Tool definition for exporting conversation to PDF.
6 * This is a client-side tool - the LLM can call it to trigger a PDF export,
7 * and the client handles the actual export logic.
8 */
9export const exportConversationToPdfTool = toolDefinition({
10 name: 'export_conversation_to_pdf',
11 description:
12 'Export the current conversation to a PDF file. The PDF will be downloaded automatically. Use this when the user asks to save, export, or download the conversation.',
13 inputSchema: z.object({
14 title: z
15 .string()
16 .optional()
17 .describe('Optional title for the PDF document'),
18 }),
19 outputSchema: z.object({
20 success: z.boolean(),
21 message: z.string(),
22 filename: z.string().optional(),
23 }),
24})