/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { subscriptionsCancel } from "../../funcs/subscriptionsCancel.js"; import * as components from "../../models/components/index.js"; import { formatResult, ToolDefinition } from "../tools.js"; const args = { id: z.string(), cancelSubscriptionRequestEntity: components.CancelSubscriptionRequestEntity$inboundSchema, }; export const tool$subscriptionsCancel: ToolDefinition = { name: "subscriptions-cancel", description: `Cancel a subscription. Cancel an active subscription immediately or schedule cancellation at period end.`, args, tool: async (client, args, ctx) => { const [result, apiCall] = await subscriptionsCancel( client, args.id, args.cancelSubscriptionRequestEntity, { 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); }, };