/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 6081b2f765e6 */ import * as z from "zod"; import { foldersSearchFolders } from "../../funcs/foldersSearchFolders.js"; import { DirectionEnum$zodSchema } from "../../models/directionenum.js"; import { formatResult, ToolDefinition } from "../tools.js"; const args = { expression: z.string().describe( "The (Lucene-like) string expression specifying the search query. If not passed, returns all folders (up to max_results).", ).optional(), sort_by: z.array(z.record(z.string(), DirectionEnum$zodSchema)).describe( "Sort order for the results. Each item maps a field name to a direction.", ).optional(), max_results: z.int().default(50).describe( "Maximum number of folders to return (max 500, default 50).", ), next_cursor: z.string().describe( "The cursor for pagination. Use the next_cursor value from a previous response to get the next page of results.", ).optional(), }; export const tool$foldersSearchFolders: ToolDefinition = { name: "search-folders", description: `Searches for folders whose attributes match a given expression Lists the folders that match the specified search expression. Limited to 2000 results. If no parameters are passed, returns the 50 most recently created folders in descending order of creation time. `, scopes: ["librarian"], annotations: { "title": "Search Folders", "destructiveHint": false, "idempotentHint": true, "openWorldHint": false, "readOnlyHint": true, }, args, tool: async (client, args, ctx) => { const [result] = await foldersSearchFolders( client, args.expression, args.sort_by, args.max_results, args.next_cursor, { fetchOptions: { signal: ctx.signal } }, ).$inspect(); if (!result.ok) { return { content: [{ type: "text", text: result.error.message }], isError: true, }; } return formatResult(result.value); }, };