fixparser-plugin-mcp 9.1.7-5c2fdc7a → 9.1.7-5f64f22e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/MCPLocal.js +244 -93
- package/build/cjs/MCPLocal.js.map +2 -2
- package/build/esm/MCPLocal.mjs +245 -103
- package/build/esm/MCPLocal.mjs.map +2 -2
- package/build-examples/cjs/example_mcp_local.js +17 -4
- package/build-examples/cjs/example_mcp_local.js.map +3 -3
- package/build-examples/esm/example_mcp_local.mjs +17 -4
- package/build-examples/esm/example_mcp_local.mjs.map +3 -3
- package/package.json +3 -3
- package/types/MCPLocal.d.ts +1 -1
package/build/esm/MCPLocal.mjs
CHANGED
|
@@ -8,16 +8,7 @@ import {
|
|
|
8
8
|
ListResourcesRequestSchema,
|
|
9
9
|
ListToolsRequestSchema
|
|
10
10
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
-
import {
|
|
12
|
-
Field,
|
|
13
|
-
Fields,
|
|
14
|
-
HandlInst,
|
|
15
|
-
MDEntryType,
|
|
16
|
-
Messages,
|
|
17
|
-
OrdType,
|
|
18
|
-
SubscriptionRequestType,
|
|
19
|
-
TimeInForce
|
|
20
|
-
} from "fixparser";
|
|
11
|
+
import { Field, Fields, Messages } from "fixparser";
|
|
21
12
|
var parseInputSchema = {
|
|
22
13
|
type: "object",
|
|
23
14
|
properties: {
|
|
@@ -38,7 +29,7 @@ var parseToJSONInputSchema = {
|
|
|
38
29
|
},
|
|
39
30
|
required: ["fixString"]
|
|
40
31
|
};
|
|
41
|
-
var
|
|
32
|
+
var orderSchema = {
|
|
42
33
|
type: "object",
|
|
43
34
|
properties: {
|
|
44
35
|
clOrdID: {
|
|
@@ -48,8 +39,7 @@ var newOrderSingleInputSchema = {
|
|
|
48
39
|
handlInst: {
|
|
49
40
|
type: "string",
|
|
50
41
|
enum: ["1", "2", "3"],
|
|
51
|
-
|
|
52
|
-
description: 'Handling instruction (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Manual, "2" for Automated, "3" for AutomatedNoIntervention)'
|
|
42
|
+
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)"
|
|
53
43
|
},
|
|
54
44
|
quantity: {
|
|
55
45
|
type: "number",
|
|
@@ -89,13 +79,12 @@ var newOrderSingleInputSchema = {
|
|
|
89
79
|
"R",
|
|
90
80
|
"S"
|
|
91
81
|
],
|
|
92
|
-
|
|
93
|
-
description: 'Order type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "1" for Market, "2" for Limit, "3" for Stop)'
|
|
82
|
+
description: "Order type (1=Market, 2=Limit, 3=Stop)"
|
|
94
83
|
},
|
|
95
84
|
side: {
|
|
96
85
|
type: "string",
|
|
97
86
|
enum: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H"],
|
|
98
|
-
description:
|
|
87
|
+
description: "Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)"
|
|
99
88
|
},
|
|
100
89
|
symbol: {
|
|
101
90
|
type: "string",
|
|
@@ -104,11 +93,10 @@ var newOrderSingleInputSchema = {
|
|
|
104
93
|
timeInForce: {
|
|
105
94
|
type: "string",
|
|
106
95
|
enum: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C"],
|
|
107
|
-
|
|
108
|
-
description: 'Time in force (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Day, "1" for Good Till Cancel, "2" for At Opening, "3" for Immediate or Cancel, "4" for Fill or Kill, "5" for Good Till Crossing, "6" for Good Till Date)'
|
|
96
|
+
description: "Time in force (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)"
|
|
109
97
|
}
|
|
110
98
|
},
|
|
111
|
-
required: ["clOrdID", "quantity", "price", "side", "symbol"]
|
|
99
|
+
required: ["clOrdID", "handlInst", "quantity", "price", "ordType", "side", "symbol", "timeInForce"]
|
|
112
100
|
};
|
|
113
101
|
var marketDataRequestInputSchema = {
|
|
114
102
|
type: "object",
|
|
@@ -116,7 +104,6 @@ var marketDataRequestInputSchema = {
|
|
|
116
104
|
mdUpdateType: {
|
|
117
105
|
type: "string",
|
|
118
106
|
enum: ["0", "1"],
|
|
119
|
-
default: "0",
|
|
120
107
|
description: 'Market data update type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for FullRefresh, "1" for IncrementalRefresh)'
|
|
121
108
|
},
|
|
122
109
|
symbol: {
|
|
@@ -130,7 +117,6 @@ var marketDataRequestInputSchema = {
|
|
|
130
117
|
subscriptionRequestType: {
|
|
131
118
|
type: "string",
|
|
132
119
|
enum: ["0", "1", "2"],
|
|
133
|
-
default: SubscriptionRequestType.SnapshotAndUpdates,
|
|
134
120
|
description: 'Subscription request type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Snapshot + Updates, "1" for Snapshot, "2" for Unsubscribe)'
|
|
135
121
|
},
|
|
136
122
|
mdEntryType: {
|
|
@@ -181,14 +167,13 @@ var marketDataRequestInputSchema = {
|
|
|
181
167
|
"i",
|
|
182
168
|
"t"
|
|
183
169
|
],
|
|
184
|
-
default: MDEntryType.Bid,
|
|
185
170
|
description: 'Market data entry type (IMPORTANT: Use the numeric/alphabetic value, not the descriptive name. For example, use "0" for Bid, "1" for Offer, "2" for Trade, "3" for Index Value, "4" for Opening Price)'
|
|
186
171
|
}
|
|
187
172
|
},
|
|
188
173
|
required: ["symbol", "mdReqID"]
|
|
189
174
|
};
|
|
190
175
|
var MCPLocal = class {
|
|
191
|
-
logger;
|
|
176
|
+
// private logger: Logger | undefined;
|
|
192
177
|
parser;
|
|
193
178
|
server = new Server(
|
|
194
179
|
{
|
|
@@ -206,28 +191,34 @@ var MCPLocal = class {
|
|
|
206
191
|
transport = new StdioServerTransport();
|
|
207
192
|
onReady = void 0;
|
|
208
193
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
194
|
+
verifiedOrders = /* @__PURE__ */ new Map();
|
|
209
195
|
constructor({ logger, onReady }) {
|
|
210
|
-
if (logger && !logger.silent) {
|
|
211
|
-
this.logger = logger;
|
|
212
|
-
}
|
|
213
196
|
if (onReady) this.onReady = onReady;
|
|
214
197
|
}
|
|
215
198
|
async register(parser) {
|
|
216
199
|
this.parser = parser;
|
|
217
|
-
if (parser.logger && !parser.logger.silent) {
|
|
218
|
-
this.logger = parser.logger;
|
|
219
|
-
}
|
|
220
200
|
this.parser.addOnMessageCallback((message) => {
|
|
221
201
|
const msgType = message.messageType;
|
|
222
|
-
if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport) {
|
|
223
|
-
const idField = msgType === Messages.MarketDataSnapshotFullRefresh ? message.getField(Fields.MDReqID) : message.getField(Fields.ClOrdID);
|
|
202
|
+
if (msgType === Messages.MarketDataSnapshotFullRefresh || msgType === Messages.ExecutionReport || msgType === Messages.Reject) {
|
|
203
|
+
const idField = msgType === Messages.MarketDataSnapshotFullRefresh ? message.getField(Fields.MDReqID) : msgType === Messages.Reject ? message.getField(Fields.RefSeqNum) : message.getField(Fields.ClOrdID);
|
|
224
204
|
if (idField) {
|
|
225
205
|
const id = idField.value;
|
|
226
206
|
if (typeof id === "string" || typeof id === "number") {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
207
|
+
if (msgType === Messages.Reject) {
|
|
208
|
+
const refMsgType = message.getField(Fields.RefMsgType);
|
|
209
|
+
if (refMsgType && refMsgType.value === Messages.NewOrderSingle) {
|
|
210
|
+
const callback = this.pendingRequests.get(String(id));
|
|
211
|
+
if (callback) {
|
|
212
|
+
callback(message);
|
|
213
|
+
this.pendingRequests.delete(String(id));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
const callback = this.pendingRequests.get(String(id));
|
|
218
|
+
if (callback) {
|
|
219
|
+
callback(message);
|
|
220
|
+
this.pendingRequests.delete(String(id));
|
|
221
|
+
}
|
|
231
222
|
}
|
|
232
223
|
}
|
|
233
224
|
}
|
|
@@ -241,17 +232,9 @@ var MCPLocal = class {
|
|
|
241
232
|
}
|
|
242
233
|
addWorkflows() {
|
|
243
234
|
if (!this.parser) {
|
|
244
|
-
this.logger?.log({
|
|
245
|
-
level: "error",
|
|
246
|
-
message: "FIXParser (MCP): -- FIXParser instance not initialized. Ignoring setup of workflows..."
|
|
247
|
-
});
|
|
248
235
|
return;
|
|
249
236
|
}
|
|
250
237
|
if (!this.server) {
|
|
251
|
-
this.logger?.log({
|
|
252
|
-
level: "error",
|
|
253
|
-
message: "FIXParser (MCP): -- MCP Server not initialized. Ignoring setup of workflows..."
|
|
254
|
-
});
|
|
255
238
|
return;
|
|
256
239
|
}
|
|
257
240
|
const validateArgs = (args, schema) => {
|
|
@@ -289,13 +272,18 @@ var MCPLocal = class {
|
|
|
289
272
|
inputSchema: parseToJSONInputSchema
|
|
290
273
|
},
|
|
291
274
|
{
|
|
292
|
-
name: "
|
|
293
|
-
description: "
|
|
294
|
-
inputSchema:
|
|
275
|
+
name: "verifyOrder",
|
|
276
|
+
description: "Verifies all parameters for a New Order Single. This is the first step - verification only, no order is sent.",
|
|
277
|
+
inputSchema: orderSchema
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "executeOrder",
|
|
281
|
+
description: "Executes a New Order Single after verification. This is the second step - only call after successful verification.",
|
|
282
|
+
inputSchema: orderSchema
|
|
295
283
|
},
|
|
296
284
|
{
|
|
297
285
|
name: "marketDataRequest",
|
|
298
|
-
description: "Sends a request for Market Data with the given symbol",
|
|
286
|
+
description: "Sends a request for Market Data with the given symbol. IMPORTANT: All parameters must be explicitly provided by the user - no assumptions will be made.",
|
|
299
287
|
inputSchema: marketDataRequestInputSchema
|
|
300
288
|
}
|
|
301
289
|
]
|
|
@@ -365,9 +353,77 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
365
353
|
};
|
|
366
354
|
}
|
|
367
355
|
}
|
|
368
|
-
case "
|
|
356
|
+
case "verifyOrder": {
|
|
357
|
+
try {
|
|
358
|
+
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = validateArgs(args, orderSchema);
|
|
359
|
+
this.verifiedOrders.set(clOrdID, {
|
|
360
|
+
clOrdID,
|
|
361
|
+
handlInst,
|
|
362
|
+
quantity,
|
|
363
|
+
price,
|
|
364
|
+
ordType,
|
|
365
|
+
side,
|
|
366
|
+
symbol,
|
|
367
|
+
timeInForce
|
|
368
|
+
});
|
|
369
|
+
return {
|
|
370
|
+
content: [
|
|
371
|
+
{
|
|
372
|
+
type: "text",
|
|
373
|
+
text: `VERIFICATION: All parameters valid. Ready to proceed with order execution.
|
|
374
|
+
|
|
375
|
+
Parameters verified:
|
|
376
|
+
- ClOrdID: ${clOrdID}
|
|
377
|
+
- HandlInst: ${handlInst}
|
|
378
|
+
- Quantity: ${quantity}
|
|
379
|
+
- Price: ${price}
|
|
380
|
+
- OrdType: ${ordType}
|
|
381
|
+
- Side: ${side}
|
|
382
|
+
- Symbol: ${symbol}
|
|
383
|
+
- TimeInForce: ${timeInForce}
|
|
384
|
+
|
|
385
|
+
To execute this order, call the executeOrder tool with these exact same parameters.`
|
|
386
|
+
}
|
|
387
|
+
]
|
|
388
|
+
};
|
|
389
|
+
} catch (error) {
|
|
390
|
+
return {
|
|
391
|
+
isError: true,
|
|
392
|
+
content: [
|
|
393
|
+
{
|
|
394
|
+
type: "text",
|
|
395
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to verify order parameters"}`
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
case "executeOrder": {
|
|
369
402
|
try {
|
|
370
|
-
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = validateArgs(args,
|
|
403
|
+
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = validateArgs(args, orderSchema);
|
|
404
|
+
const verifiedOrder = this.verifiedOrders.get(clOrdID);
|
|
405
|
+
if (!verifiedOrder) {
|
|
406
|
+
return {
|
|
407
|
+
isError: true,
|
|
408
|
+
content: [
|
|
409
|
+
{
|
|
410
|
+
type: "text",
|
|
411
|
+
text: `Error: Order ${clOrdID} has not been verified. Please call verifyOrder first.`
|
|
412
|
+
}
|
|
413
|
+
]
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
if (verifiedOrder.handlInst !== handlInst || verifiedOrder.quantity !== quantity || verifiedOrder.price !== price || verifiedOrder.ordType !== ordType || verifiedOrder.side !== side || verifiedOrder.symbol !== symbol || verifiedOrder.timeInForce !== timeInForce) {
|
|
417
|
+
return {
|
|
418
|
+
isError: true,
|
|
419
|
+
content: [
|
|
420
|
+
{
|
|
421
|
+
type: "text",
|
|
422
|
+
text: "Error: Order parameters do not match the verified order. Please use the exact same parameters that were verified."
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
};
|
|
426
|
+
}
|
|
371
427
|
const response = new Promise((resolve) => {
|
|
372
428
|
this.pendingRequests.set(clOrdID, resolve);
|
|
373
429
|
});
|
|
@@ -388,10 +444,6 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
388
444
|
new Field(Fields.TransactTime, this.parser?.getTimestamp())
|
|
389
445
|
);
|
|
390
446
|
if (!this.parser?.connected) {
|
|
391
|
-
this.logger?.log({
|
|
392
|
-
level: "error",
|
|
393
|
-
message: "FIXParser (MCP): -- Not connected. Ignoring message."
|
|
394
|
-
});
|
|
395
447
|
return {
|
|
396
448
|
isError: true,
|
|
397
449
|
content: [
|
|
@@ -403,16 +455,13 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
403
455
|
};
|
|
404
456
|
}
|
|
405
457
|
this.parser?.send(order);
|
|
406
|
-
this.logger?.log({
|
|
407
|
-
level: "info",
|
|
408
|
-
message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${order?.description}`
|
|
409
|
-
});
|
|
410
458
|
const fixData = await response;
|
|
459
|
+
this.verifiedOrders.delete(clOrdID);
|
|
411
460
|
return {
|
|
412
461
|
content: [
|
|
413
462
|
{
|
|
414
463
|
type: "text",
|
|
415
|
-
text: `Execution Report for order ${clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}`
|
|
464
|
+
text: fixData.messageType === Messages.Reject ? `Reject message for order ${clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}` : `Execution Report for order ${clOrdID}: ${JSON.stringify(fixData.toFIXJSON())}`
|
|
416
465
|
}
|
|
417
466
|
]
|
|
418
467
|
};
|
|
@@ -422,7 +471,7 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
422
471
|
content: [
|
|
423
472
|
{
|
|
424
473
|
type: "text",
|
|
425
|
-
text: `Error: ${error instanceof Error ? error.message : "Failed to
|
|
474
|
+
text: `Error: ${error instanceof Error ? error.message : "Failed to execute order"}`
|
|
426
475
|
}
|
|
427
476
|
]
|
|
428
477
|
};
|
|
@@ -453,10 +502,6 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
453
502
|
new Field(Fields.MDEntryType, mdEntryType)
|
|
454
503
|
);
|
|
455
504
|
if (!this.parser?.connected) {
|
|
456
|
-
this.logger?.log({
|
|
457
|
-
level: "error",
|
|
458
|
-
message: "FIXParser (MCP): -- Not connected. Ignoring message."
|
|
459
|
-
});
|
|
460
505
|
return {
|
|
461
506
|
isError: true,
|
|
462
507
|
content: [
|
|
@@ -468,10 +513,6 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
468
513
|
};
|
|
469
514
|
}
|
|
470
515
|
this.parser?.send(marketDataRequest);
|
|
471
|
-
this.logger?.log({
|
|
472
|
-
level: "info",
|
|
473
|
-
message: `FIXParser (MCP): (${this.parser?.protocol?.toUpperCase()}): >> sent ${marketDataRequest?.description}`
|
|
474
|
-
});
|
|
475
516
|
const fixData = await response;
|
|
476
517
|
return {
|
|
477
518
|
content: [
|
|
@@ -523,8 +564,8 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
523
564
|
]
|
|
524
565
|
},
|
|
525
566
|
{
|
|
526
|
-
name: "
|
|
527
|
-
description: "
|
|
567
|
+
name: "verifyOrder",
|
|
568
|
+
description: "Verifies all parameters for a New Order Single. This is the first step - verification only, no order is sent.",
|
|
528
569
|
arguments: [
|
|
529
570
|
{
|
|
530
571
|
name: "clOrdID",
|
|
@@ -533,8 +574,8 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
533
574
|
},
|
|
534
575
|
{
|
|
535
576
|
name: "handlInst",
|
|
536
|
-
description: "Handling instruction",
|
|
537
|
-
required:
|
|
577
|
+
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
578
|
+
required: true
|
|
538
579
|
},
|
|
539
580
|
{
|
|
540
581
|
name: "quantity",
|
|
@@ -548,8 +589,8 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
548
589
|
},
|
|
549
590
|
{
|
|
550
591
|
name: "ordType",
|
|
551
|
-
description: "Order type",
|
|
552
|
-
required:
|
|
592
|
+
description: "Order type (1=Market, 2=Limit, 3=Stop)",
|
|
593
|
+
required: true
|
|
553
594
|
},
|
|
554
595
|
{
|
|
555
596
|
name: "side",
|
|
@@ -563,19 +604,65 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
563
604
|
},
|
|
564
605
|
{
|
|
565
606
|
name: "timeInForce",
|
|
566
|
-
description: "Time in force",
|
|
567
|
-
required:
|
|
607
|
+
description: "Time in force (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)",
|
|
608
|
+
required: true
|
|
609
|
+
}
|
|
610
|
+
]
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
name: "executeOrder",
|
|
614
|
+
description: "Executes a New Order Single after verification. This is the second step - only call after successful verification.",
|
|
615
|
+
arguments: [
|
|
616
|
+
{
|
|
617
|
+
name: "clOrdID",
|
|
618
|
+
description: "Client Order ID",
|
|
619
|
+
required: true
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
name: "handlInst",
|
|
623
|
+
description: "Handling instruction (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
624
|
+
required: true
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
name: "quantity",
|
|
628
|
+
description: "Order quantity",
|
|
629
|
+
required: true
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "price",
|
|
633
|
+
description: "Order price",
|
|
634
|
+
required: true
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: "ordType",
|
|
638
|
+
description: "Order type (1=Market, 2=Limit, 3=Stop)",
|
|
639
|
+
required: true
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
name: "side",
|
|
643
|
+
description: "Order side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)",
|
|
644
|
+
required: true
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: "symbol",
|
|
648
|
+
description: "Trading symbol",
|
|
649
|
+
required: true
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "timeInForce",
|
|
653
|
+
description: "Time in force (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)",
|
|
654
|
+
required: true
|
|
568
655
|
}
|
|
569
656
|
]
|
|
570
657
|
},
|
|
571
658
|
{
|
|
572
659
|
name: "marketDataRequest",
|
|
573
|
-
description: "Sends a request for Market Data with the given symbol",
|
|
660
|
+
description: "Sends a request for Market Data with the given symbol. IMPORTANT: All parameters must be explicitly provided by the user - no assumptions will be made.",
|
|
574
661
|
arguments: [
|
|
575
662
|
{
|
|
576
663
|
name: "mdUpdateType",
|
|
577
|
-
description: "Market data update type",
|
|
578
|
-
required:
|
|
664
|
+
description: "Market data update type (0=FullRefresh, 1=IncrementalRefresh)",
|
|
665
|
+
required: true
|
|
579
666
|
},
|
|
580
667
|
{
|
|
581
668
|
name: "symbol",
|
|
@@ -589,13 +676,13 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
589
676
|
},
|
|
590
677
|
{
|
|
591
678
|
name: "subscriptionRequestType",
|
|
592
|
-
description: "Subscription request type",
|
|
593
|
-
required:
|
|
679
|
+
description: "Subscription request type (0=Snapshot + Updates, 1=Snapshot, 2=Unsubscribe)",
|
|
680
|
+
required: true
|
|
594
681
|
},
|
|
595
682
|
{
|
|
596
683
|
name: "mdEntryType",
|
|
597
|
-
description: "Market data entry type",
|
|
598
|
-
required:
|
|
684
|
+
description: "Market data entry type (0=Bid, 1=Offer, 2=Trade, 3=Index Value, 4=Opening Price)",
|
|
685
|
+
required: true
|
|
599
686
|
}
|
|
600
687
|
]
|
|
601
688
|
}
|
|
@@ -633,7 +720,7 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
633
720
|
]
|
|
634
721
|
};
|
|
635
722
|
}
|
|
636
|
-
case "
|
|
723
|
+
case "verifyOrder": {
|
|
637
724
|
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};
|
|
638
725
|
return {
|
|
639
726
|
messages: [
|
|
@@ -642,22 +729,68 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
642
729
|
content: {
|
|
643
730
|
type: "text",
|
|
644
731
|
text: [
|
|
645
|
-
"
|
|
732
|
+
"You are an AI assistant that helps users verify FIX New Order Single parameters.",
|
|
733
|
+
"This is STEP 1 of 2 - VERIFICATION ONLY. No order will be sent at this stage.",
|
|
734
|
+
"",
|
|
735
|
+
"You must verify that all required fields are provided and valid:",
|
|
736
|
+
"- ClOrdID (Client Order ID)",
|
|
737
|
+
"- HandlInst (1=Manual, 2=Automated, 3=AutomatedNoIntervention)",
|
|
738
|
+
"- Quantity (Order quantity)",
|
|
739
|
+
"- Price (Order price)",
|
|
740
|
+
"- OrdType (1=Market, 2=Limit, 3=Stop)",
|
|
741
|
+
"- Side (1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed)",
|
|
742
|
+
"- Symbol (Trading symbol)",
|
|
743
|
+
"- TimeInForce (0=Day, 1=Good Till Cancel, 2=At Opening, 3=Immediate or Cancel, 4=Fill or Kill, 5=Good Till Crossing, 6=Good Till Date)",
|
|
744
|
+
"",
|
|
745
|
+
"Current parameters to verify:",
|
|
646
746
|
`- ClOrdID: ${clOrdID}`,
|
|
647
|
-
`- HandlInst: ${handlInst
|
|
747
|
+
`- HandlInst: ${handlInst}`,
|
|
648
748
|
`- Quantity: ${quantity}`,
|
|
649
749
|
`- Price: ${price}`,
|
|
650
|
-
`- OrdType: ${ordType
|
|
651
|
-
`- Side: ${side}
|
|
750
|
+
`- OrdType: ${ordType}`,
|
|
751
|
+
`- Side: ${side}`,
|
|
652
752
|
`- Symbol: ${symbol}`,
|
|
653
|
-
`- TimeInForce: ${timeInForce
|
|
753
|
+
`- TimeInForce: ${timeInForce}`,
|
|
754
|
+
"",
|
|
755
|
+
"If all parameters are valid, respond with:",
|
|
756
|
+
"`VERIFICATION: All parameters valid. Ready to proceed.`",
|
|
654
757
|
"",
|
|
655
|
-
"
|
|
758
|
+
"Otherwise, list the missing or invalid ones.",
|
|
656
759
|
"",
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
760
|
+
"IMPORTANT: This is only verification. To actually send the order, the user must call the executeOrder tool with the same parameters."
|
|
761
|
+
].join("\n")
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
]
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
case "executeOrder": {
|
|
768
|
+
const { clOrdID, handlInst, quantity, price, ordType, side, symbol, timeInForce } = args || {};
|
|
769
|
+
return {
|
|
770
|
+
messages: [
|
|
771
|
+
{
|
|
772
|
+
role: "user",
|
|
773
|
+
content: {
|
|
774
|
+
type: "text",
|
|
775
|
+
text: [
|
|
776
|
+
"You are an AI assistant that helps users execute FIX New Order Single messages.",
|
|
777
|
+
"This is STEP 2 of 2 - EXECUTION. This will send the order to the market.",
|
|
778
|
+
"",
|
|
779
|
+
"IMPORTANT: This tool should only be called after successful verification of all parameters.",
|
|
780
|
+
"",
|
|
781
|
+
"Parameters to execute:",
|
|
782
|
+
`- ClOrdID: ${clOrdID}`,
|
|
783
|
+
`- HandlInst: ${handlInst}`,
|
|
784
|
+
`- Quantity: ${quantity}`,
|
|
785
|
+
`- Price: ${price}`,
|
|
786
|
+
`- OrdType: ${ordType}`,
|
|
787
|
+
`- Side: ${side}`,
|
|
788
|
+
`- Symbol: ${symbol}`,
|
|
789
|
+
`- TimeInForce: ${timeInForce}`,
|
|
790
|
+
"",
|
|
791
|
+
"IMPORTANT: The response will be either:",
|
|
792
|
+
"1. An Execution Report (MsgType=8) if the order was successfully placed",
|
|
793
|
+
"2. A Reject message (MsgType=3) if the order failed to execute (e.g., due to missing or invalid parameters)"
|
|
661
794
|
].join("\n")
|
|
662
795
|
}
|
|
663
796
|
}
|
|
@@ -673,18 +806,27 @@ ${parsedMessage[0].messageTypeDescription}`
|
|
|
673
806
|
content: {
|
|
674
807
|
type: "text",
|
|
675
808
|
text: [
|
|
676
|
-
"
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
809
|
+
"You are an AI assistant that helps users create FIX Market Data Request messages.",
|
|
810
|
+
"You must **first verify** that all required fields are provided:",
|
|
811
|
+
"- MDUpdateType (0=FullRefresh, 1=IncrementalRefresh)",
|
|
812
|
+
"- Symbol (Trading symbol)",
|
|
813
|
+
"- MDReqID (Market data request ID)",
|
|
814
|
+
"- SubscriptionRequestType (0=Snapshot + Updates, 1=Snapshot, 2=Unsubscribe)",
|
|
815
|
+
"- MDEntryType (0=Bid, 1=Offer, 2=Trade, 3=Index Value, 4=Opening Price)",
|
|
816
|
+
"",
|
|
817
|
+
"Only when all fields are present and valid, respond with:",
|
|
818
|
+
"`VERIFICATION: All parameters valid. Ready to proceed.`",
|
|
682
819
|
"",
|
|
683
|
-
"
|
|
820
|
+
"Otherwise, list the missing or invalid ones.",
|
|
684
821
|
"",
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
822
|
+
"Do not create the FIX message until verification is complete.",
|
|
823
|
+
"",
|
|
824
|
+
"Current parameters:",
|
|
825
|
+
`- MDUpdateType: ${mdUpdateType}`,
|
|
826
|
+
`- Symbol: ${symbol}`,
|
|
827
|
+
`- MDReqID: ${mdReqID}`,
|
|
828
|
+
`- SubscriptionRequestType: ${subscriptionRequestType}`,
|
|
829
|
+
`- MDEntryType: ${mdEntryType}`
|
|
688
830
|
].join("\n")
|
|
689
831
|
}
|
|
690
832
|
}
|