jupiter_limit_order_create
Create limit orders on Solana to buy or sell tokens at a specified price. Supports single, OCO (take-profit/stop-loss), and OTOCO order types.
Instructions
Create a limit order. Returns a transaction to sign. Supports single, OCO (TP/SL), and OTOCO orders.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputMint | Yes | Mint of token to sell | |
| outputMint | Yes | Mint of token to buy | |
| inAmount | Yes | Amount to sell in base units | |
| outAmount | Yes | Min amount to receive (sets limit price) | |
| maker | Yes | Wallet address creating the order | |
| expiredAt | No | ISO 8601 expiration time |
Implementation Reference
- src/tools/trigger.ts:29-32 (handler)The async handler function that executes the tool logic for jupiter_limit_order_create. It calls client.triggerCreate(args) and returns the result as a JSON string.
async (args) => { const result = await client.triggerCreate(args); return JSON.stringify(result, null, 2); }, - src/tools/trigger.ts:21-27 (schema)Input schema (Zod) defining the expected parameters: inputMint, outputMint, inAmount, outAmount, maker (all required strings), and expiredAt (optional string).
{ inputMint: z.string().describe("Mint of token to sell"), outputMint: z.string().describe("Mint of token to buy"), inAmount: z.string().describe("Amount to sell in base units"), outAmount: z.string().describe("Min amount to receive (sets limit price)"), maker: z.string().describe("Wallet address creating the order"), expiredAt: z.string().optional().describe("ISO 8601 expiration time"), - src/tools/trigger.ts:18-33 (registration)Registration of the tool 'jupiter_limit_order_create' via the register() function in the registerTriggerTools function.
register( "jupiter_limit_order_create", "Create a limit order. Returns a transaction to sign. Supports single, OCO (TP/SL), and OTOCO orders.", { inputMint: z.string().describe("Mint of token to sell"), outputMint: z.string().describe("Mint of token to buy"), inAmount: z.string().describe("Amount to sell in base units"), outAmount: z.string().describe("Min amount to receive (sets limit price)"), maker: z.string().describe("Wallet address creating the order"), expiredAt: z.string().optional().describe("ISO 8601 expiration time"), }, async (args) => { const result = await client.triggerCreate(args); return JSON.stringify(result, null, 2); }, ); - src/client.ts:148-161 (helper)The triggerCreate client method that makes the actual HTTP POST request to /trigger/v2/orders/price with the provided parameters.
/** Create a limit order (returns transaction to sign) */ async triggerCreate(params: { inputMint: string; outputMint: string; inAmount: string; outAmount: string; maker: string; expiredAt?: string; }) { return this.request("/trigger/v2/orders/price", { method: "POST", body: params, }); } - src/index.ts:40-58 (registration)The generic register() wrapper in the entry point that calls server.tool() from the MCP SDK, connecting the tool to the MCP server.
function register( name: string, description: string, shape: Record<string, z.ZodType>, handler: (args: any) => Promise<string>, ) { server.tool(name, description, shape, async (args) => { try { const text = await handler(args); return { content: [{ type: "text" as const, text }] }; } catch (err: any) { return { content: [{ type: "text" as const, text: `Error: ${err.message}` }], isError: true, }; } }); toolCount++; }