/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { constructionConstructionMetadata } from "../../funcs/constructionConstructionMetadata.js";
import * as models from "../../models/index.js";
import { formatResult, ToolDefinition } from "../tools.js";
const args = {
request: models.ConstructionMetadataRequest$inboundSchema,
};
export const tool$constructionConstructionMetadata: ToolDefinition<
typeof args
> = {
name: "construction-construction-metadata",
description: `Get Metadata for Transaction Construction
Get any information required to construct a transaction for a specific network. Metadata returned here could be a recent hash to use, an account sequence number, or even arbitrary chain state. The request used when calling this endpoint is created by calling \`/construction/preprocess\` in an offline environment. You should NEVER assume that the request sent to this endpoint will be created by the caller or populated with any custom parameters. This must occur in \`/construction/preprocess\`. It is important to clarify that this endpoint should not pre-construct any transactions for the client (this should happen in \`/construction/payloads\`). This endpoint is left purposely unstructured because of the wide scope of metadata that could be required.`,
args,
tool: async (client, args, ctx) => {
const [result, apiCall] = await constructionConstructionMetadata(
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);
},
};