adjust_rob
Modify ADA amounts in an ROB position on Cardano by increasing or decreasing collateral, with optional price limit updates, and generate unsigned transactions for signing.
Instructions
Adjust ADA amount in an ROB position (positive to increase, negative to decrease). Optionally update the max price. Returns an unsigned transaction (CBOR hex) for client-side signing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | User Cardano bech32 address | |
| robTxHash | Yes | Transaction hash of the ROB UTxO | |
| robOutputIndex | Yes | Output index of the ROB UTxO | |
| lovelacesAdjustAmount | Yes | Lovelace adjustment amount (positive to add, negative to remove) | |
| newMaxPrice | No | Optional new max price as an on-chain integer string |
Implementation Reference
- src/tools/rob-write-tools.ts:117-133 (handler)The async handler function for the adjust_rob tool, which builds the unsigned transaction by calling adjustLrp.
async ({ address, robTxHash, robOutputIndex, lovelacesAdjustAmount, newMaxPrice }) => { try { const result = await buildUnsignedTx( address, async (lucid) => { const params = await getSystemParams(); const robOutRef = { txHash: robTxHash, outputIndex: robOutputIndex }; const newMaxPriceDecimal = newMaxPrice !== undefined ? parseMaxPrice(newMaxPrice) : undefined; return adjustLrp( lucid, robOutRef, BigInt(lovelacesAdjustAmount), newMaxPriceDecimal, params ); }, - src/tools/rob-write-tools.ts:105-116 (schema)Zod schema definition for the adjust_rob tool input parameters.
{ address: z.string().describe('User Cardano bech32 address'), robTxHash: z.string().describe('Transaction hash of the ROB UTxO'), robOutputIndex: z.number().describe('Output index of the ROB UTxO'), lovelacesAdjustAmount: z .string() .describe('Lovelace adjustment amount (positive to add, negative to remove)'), newMaxPrice: z .string() .optional() .describe('Optional new max price as an on-chain integer string'), }, - src/tools/rob-write-tools.ts:102-133 (registration)Tool registration for adjust_rob within the server instance.
server.tool( 'adjust_rob', 'Adjust ADA amount in an ROB position (positive to increase, negative to decrease). Optionally update the max price. Returns an unsigned transaction (CBOR hex) for client-side signing.', { address: z.string().describe('User Cardano bech32 address'), robTxHash: z.string().describe('Transaction hash of the ROB UTxO'), robOutputIndex: z.number().describe('Output index of the ROB UTxO'), lovelacesAdjustAmount: z .string() .describe('Lovelace adjustment amount (positive to add, negative to remove)'), newMaxPrice: z .string() .optional() .describe('Optional new max price as an on-chain integer string'), }, async ({ address, robTxHash, robOutputIndex, lovelacesAdjustAmount, newMaxPrice }) => { try { const result = await buildUnsignedTx( address, async (lucid) => { const params = await getSystemParams(); const robOutRef = { txHash: robTxHash, outputIndex: robOutputIndex }; const newMaxPriceDecimal = newMaxPrice !== undefined ? parseMaxPrice(newMaxPrice) : undefined; return adjustLrp( lucid, robOutRef, BigInt(lovelacesAdjustAmount), newMaxPriceDecimal, params ); },