/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { eventsEventsBlocks } from "../../funcs/eventsEventsBlocks.js";
import * as models from "../../models/index.js";
import { formatResult, ToolDefinition } from "../tools.js";
const args = {
request: models.EventsBlocksRequest$inboundSchema,
};
export const tool$eventsEventsBlocks: ToolDefinition<typeof args> = {
name: "events-events-blocks",
description: `[INDEXER] Get a range of BlockEvents
\`/events/blocks\` allows the caller to query a sequence of BlockEvents indicating which blocks were added and removed from storage to reach the current state. Following BlockEvents allows lightweight clients to update their state without needing to implement their own syncing logic (like finding the common parent in a reorg). \`/events/blocks\` is considered an "indexer" endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta spec. However, any Rosetta "indexer" MUST support this endpoint.`,
args,
tool: async (client, args, ctx) => {
const [result, apiCall] = await eventsEventsBlocks(
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);
},
};