/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { documentsGetChunks } from "../../funcs/documentsGetChunks.js"; import * as operations from "../../models/operations/index.js"; import { formatResult, ToolDefinition } from "../tools.js"; const args = { request: operations.GetDocumentChunksRequest$inboundSchema, }; export const tool$documentsGetChunks: ToolDefinition = { name: "documents-get-chunks", description: `Get Document Chunks List all document chunks sorted by index in ascending order. May be limited to a range of chunk indices with the \`start_index\` and \`end_index\` parameters. Documents created prior to 9/18/2024, which have not been updated since, have chunks which do not include an index and their index will be returned as -1. They will be sorted by their ID instead. Updating the document using the \`Update Document File\` or \`Update Document Raw\` endpoint will regenerate document chunks, including their index. Results are paginated with a max limit of 100. When more chunks are available, a \`cursor\` will be provided. Use the \`cursor\` parameter to retrieve the subsequent page.`, args, tool: async (client, args, ctx) => { const [result, apiCall] = await documentsGetChunks( client, args.request, { fetchOptions: { signal: ctx.signal } }, ).$inspect(); if (!result.ok) { return { content: [{ type: "text", text: result.error.message }], isError: true, }; } const value = result.value; return formatResult(value, apiCall); }, };