/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { blocksListBlocksApiV1LedgersLedgerCanisterIdBlocksGet } from "../../funcs/blocksListBlocksApiV1LedgersLedgerCanisterIdBlocksGet.js"; import * as operations from "../../models/operations/index.js"; import { formatResult, ToolDefinition } from "../tools.js"; const args = { request: operations .ListBlocksApiV1LedgersLedgerCanisterIdBlocksGetRequest$inboundSchema, }; export const tool$blocksListBlocksApiV1LedgersLedgerCanisterIdBlocksGet: ToolDefinition = { name: "blocks-list-v1", description: `List blocks Original tool name: blocks-list-blocks-api-v1-ledgers-ledger-canister-id-blocks-get This endpoint returns blocks, the total blocks, and the max block index. The max block index is used to keep track of the location in the dataset for pagination purposes. ### How is data retrieved for this endpoint? Values from the endpoint are retrieved by scraping the blocks from the ledger canister (and associated archive canisters).`, args, tool: async (client, args, ctx) => { const [result, apiCall] = await blocksListBlocksApiV1LedgersLedgerCanisterIdBlocksGet( 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); }, };