/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { constructionConstructionPreprocess } from "../../funcs/constructionConstructionPreprocess.js";
import * as models from "../../models/index.js";
import { formatResult, ToolDefinition } from "../tools.js";
const args = {
request: models.ConstructionPreprocessRequest$inboundSchema,
};
export const tool$constructionConstructionPreprocess: ToolDefinition<
typeof args
> = {
name: "construction-construction-preprocess",
description: `Create a Request to Fetch Metadata
Preprocess is called prior to \`/construction/payloads\` to construct a request for any metadata that is needed for transaction construction given (i.e. account nonce). The \`options\` object returned from this endpoint will be sent to the \`/construction/metadata\` endpoint UNMODIFIED by the caller (in an offline execution environment). If your Construction API implementation has configuration options, they MUST be specified in the \`/construction/preprocess\` request (in the \`metadata\` field).`,
args,
tool: async (client, args, ctx) => {
const [result, apiCall] = await constructionConstructionPreprocess(
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);
},
};