angel-one-mcp 1.0.1
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/LICENSE +21 -0
- package/README.md +120 -0
- package/build/api.d.ts +90 -0
- package/build/api.js +246 -0
- package/build/config.d.ts +15 -0
- package/build/config.js +42 -0
- package/build/guards.d.ts +7 -0
- package/build/guards.js +46 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +24 -0
- package/build/tools/auth.d.ts +3 -0
- package/build/tools/auth.js +65 -0
- package/build/tools/calculator.d.ts +3 -0
- package/build/tools/calculator.js +137 -0
- package/build/tools/gtt.d.ts +4 -0
- package/build/tools/gtt.js +297 -0
- package/build/tools/index.d.ts +4 -0
- package/build/tools/index.js +16 -0
- package/build/tools/market.d.ts +3 -0
- package/build/tools/market.js +399 -0
- package/build/tools/orders.d.ts +4 -0
- package/build/tools/orders.js +331 -0
- package/build/tools/portfolio.d.ts +4 -0
- package/build/tools/portfolio.js +186 -0
- package/build/tools/user.d.ts +3 -0
- package/build/tools/user.js +32 -0
- package/build/totp.d.ts +1 -0
- package/build/totp.js +12 -0
- package/build/types.d.ts +186 -0
- package/build/types.js +10 -0
- package/package.json +72 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export function registerAuthTools(server, api) {
|
|
2
|
+
server.registerTool("login", {
|
|
3
|
+
description: "Authenticate with Angel One SmartAPI. Auto-generates TOTP. Stores session internally.",
|
|
4
|
+
annotations: { openWorldHint: true },
|
|
5
|
+
}, async () => {
|
|
6
|
+
try {
|
|
7
|
+
await api.login();
|
|
8
|
+
return {
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: "text",
|
|
12
|
+
text: JSON.stringify({
|
|
13
|
+
success: true,
|
|
14
|
+
message: "Login successful",
|
|
15
|
+
}, null, 2),
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: "text",
|
|
25
|
+
text: JSON.stringify({
|
|
26
|
+
success: false,
|
|
27
|
+
error: error instanceof Error ? error.message : String(error),
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
isError: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
server.registerTool("logout", {
|
|
36
|
+
description: "End Angel One SmartAPI session and invalidate tokens.",
|
|
37
|
+
annotations: { openWorldHint: true },
|
|
38
|
+
}, async () => {
|
|
39
|
+
try {
|
|
40
|
+
await api.logout();
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: "text",
|
|
45
|
+
text: JSON.stringify({ success: true, message: "Logged out" }),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: JSON.stringify({
|
|
56
|
+
success: false,
|
|
57
|
+
error: error instanceof Error ? error.message : String(error),
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
isError: true,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerCalculatorTools(server, api) {
|
|
3
|
+
server.registerTool("estimate_margin", {
|
|
4
|
+
description: "Calculate margin requirements for a batch of potential orders before placing them.",
|
|
5
|
+
annotations: { openWorldHint: true },
|
|
6
|
+
inputSchema: {
|
|
7
|
+
positions: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe('JSON array of position objects. Each: { "exchange": "NSE", "qty": "10", "price": "100.5", "productType": "INTRADAY", "token": "3045", "tradeType": "BUY" }'),
|
|
10
|
+
},
|
|
11
|
+
}, async (params) => {
|
|
12
|
+
try {
|
|
13
|
+
let parsed;
|
|
14
|
+
try {
|
|
15
|
+
parsed = JSON.parse(params.positions);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: JSON.stringify({
|
|
23
|
+
success: false,
|
|
24
|
+
error: "Invalid JSON in positions. Expected an array of objects with: exchange, qty, price, productType, token, tradeType",
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
isError: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (!Array.isArray(parsed)) {
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: "text",
|
|
36
|
+
text: JSON.stringify({
|
|
37
|
+
success: false,
|
|
38
|
+
error: "positions must be a JSON array, not a single object",
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const data = await api.estimateMargin({ positions: parsed });
|
|
46
|
+
return {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: "text",
|
|
50
|
+
text: JSON.stringify({ success: true, data }, null, 2),
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: "text",
|
|
60
|
+
text: JSON.stringify({
|
|
61
|
+
success: false,
|
|
62
|
+
error: error instanceof Error ? error.message : String(error),
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
isError: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
server.registerTool("estimate_charges", {
|
|
71
|
+
description: "Estimate brokerage, STT, transaction charges, GST, SEBI charges, and stamp duty for proposed trades.",
|
|
72
|
+
annotations: { openWorldHint: true },
|
|
73
|
+
inputSchema: {
|
|
74
|
+
orders: z
|
|
75
|
+
.string()
|
|
76
|
+
.describe('JSON array of order objects. Each: { "product_type": "DELIVERY", "transaction_type": "BUY", "quantity": "10", "price": "100.5", "exchange": "NSE", "symbol_name": "RELIANCE-EQ", "token": "2885" }'),
|
|
77
|
+
},
|
|
78
|
+
}, async (params) => {
|
|
79
|
+
try {
|
|
80
|
+
let parsed;
|
|
81
|
+
try {
|
|
82
|
+
parsed = JSON.parse(params.orders);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: JSON.stringify({
|
|
90
|
+
success: false,
|
|
91
|
+
error: "Invalid JSON in orders. Expected an array of objects with: product_type, transaction_type, quantity, price, exchange, symbol_name, token",
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
isError: true,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (!Array.isArray(parsed)) {
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: JSON.stringify({
|
|
104
|
+
success: false,
|
|
105
|
+
error: "orders must be a JSON array, not a single object",
|
|
106
|
+
}),
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
isError: true,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const data = await api.estimateCharges({ orders: parsed });
|
|
113
|
+
return {
|
|
114
|
+
content: [
|
|
115
|
+
{
|
|
116
|
+
type: "text",
|
|
117
|
+
text: JSON.stringify({ success: true, data }, null, 2),
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
return {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: "text",
|
|
127
|
+
text: JSON.stringify({
|
|
128
|
+
success: false,
|
|
129
|
+
error: error instanceof Error ? error.message : String(error),
|
|
130
|
+
}),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
isError: true,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { AngelOneAPI } from "../api.js";
|
|
3
|
+
import type { SafetyConfig } from "../config.js";
|
|
4
|
+
export declare function registerGttTools(server: McpServer, api: AngelOneAPI, config: SafetyConfig): void;
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { validateOrderLimits } from "../guards.js";
|
|
3
|
+
export function registerGttTools(server, api, config) {
|
|
4
|
+
server.registerTool("create_gtt_rule", {
|
|
5
|
+
description: "Create a GTT (Good Till Triggered) rule. When trigger price is hit, the order is automatically placed.",
|
|
6
|
+
annotations: { destructiveHint: true, openWorldHint: true },
|
|
7
|
+
inputSchema: {
|
|
8
|
+
tradingsymbol: z.string().describe("Trading symbol (e.g. SBIN-EQ)"),
|
|
9
|
+
symboltoken: z.string().describe("Symbol token from search_scrip"),
|
|
10
|
+
exchange: z.enum(["NSE", "BSE", "NFO", "MCX", "BFO", "CDS"]).describe("Exchange"),
|
|
11
|
+
producttype: z
|
|
12
|
+
.enum(["DELIVERY", "CARRYFORWARD", "MARGIN", "INTRADAY", "BO"])
|
|
13
|
+
.describe("Product type"),
|
|
14
|
+
transactiontype: z.enum(["BUY", "SELL"]).describe("BUY or SELL"),
|
|
15
|
+
price: z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^\d+(\.\d+)?$/, "Must be a decimal number")
|
|
18
|
+
.describe("Limit price for the order"),
|
|
19
|
+
qty: z.string().regex(/^\d+$/, "Must be a positive integer").describe("Quantity to trade"),
|
|
20
|
+
disclosedqty: z
|
|
21
|
+
.string()
|
|
22
|
+
.regex(/^\d+$/, "Must be a non-negative integer")
|
|
23
|
+
.describe("Disclosed quantity"),
|
|
24
|
+
triggerprice: z
|
|
25
|
+
.string()
|
|
26
|
+
.regex(/^\d+(\.\d+)?$/, "Must be a decimal number")
|
|
27
|
+
.describe("Price at which the order triggers"),
|
|
28
|
+
timeperiod: z
|
|
29
|
+
.string()
|
|
30
|
+
.regex(/^\d+$/, "Must be a positive integer")
|
|
31
|
+
.describe("Validity in days (e.g. 365)"),
|
|
32
|
+
force: z.boolean().optional().describe("Set true to bypass soft quantity/value limits"),
|
|
33
|
+
},
|
|
34
|
+
}, async (params) => {
|
|
35
|
+
try {
|
|
36
|
+
const qty = Number(params.qty);
|
|
37
|
+
const price = Number(params.price);
|
|
38
|
+
const disclosedQty = Number(params.disclosedqty);
|
|
39
|
+
if (disclosedQty > qty) {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: JSON.stringify({
|
|
45
|
+
success: false,
|
|
46
|
+
error: `Disclosed quantity (${disclosedQty}) cannot exceed total quantity (${qty})`,
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
isError: true,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const guard = validateOrderLimits(config, qty, price, params.force ?? false);
|
|
54
|
+
if (!guard.allowed) {
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: "text",
|
|
59
|
+
text: JSON.stringify({ success: false, error: guard.error }),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
isError: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const { force: _, ...gttParams } = params;
|
|
66
|
+
const data = await api.createGttRule(gttParams);
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{
|
|
70
|
+
type: "text",
|
|
71
|
+
text: JSON.stringify({ success: true, message: "GTT rule created", data }, null, 2),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: "text",
|
|
81
|
+
text: JSON.stringify({
|
|
82
|
+
success: false,
|
|
83
|
+
error: error instanceof Error ? error.message : String(error),
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
isError: true,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
server.registerTool("modify_gtt_rule", {
|
|
92
|
+
description: "Modify an existing GTT rule. Change price, quantity, or trigger price.",
|
|
93
|
+
annotations: { destructiveHint: true, openWorldHint: true },
|
|
94
|
+
inputSchema: {
|
|
95
|
+
id: z.string().describe("GTT rule ID to modify"),
|
|
96
|
+
tradingsymbol: z.string().describe("Trading symbol (e.g. SBIN-EQ)"),
|
|
97
|
+
symboltoken: z.string().describe("Symbol token from search_scrip"),
|
|
98
|
+
exchange: z.enum(["NSE", "BSE", "NFO", "MCX", "BFO", "CDS"]).describe("Exchange"),
|
|
99
|
+
producttype: z
|
|
100
|
+
.enum(["DELIVERY", "CARRYFORWARD", "MARGIN", "INTRADAY", "BO"])
|
|
101
|
+
.describe("Product type"),
|
|
102
|
+
transactiontype: z.enum(["BUY", "SELL"]).describe("BUY or SELL"),
|
|
103
|
+
price: z
|
|
104
|
+
.string()
|
|
105
|
+
.regex(/^\d+(\.\d+)?$/, "Must be a decimal number")
|
|
106
|
+
.describe("Limit price for the order"),
|
|
107
|
+
qty: z.string().regex(/^\d+$/, "Must be a positive integer").describe("Quantity to trade"),
|
|
108
|
+
disclosedqty: z
|
|
109
|
+
.string()
|
|
110
|
+
.regex(/^\d+$/, "Must be a non-negative integer")
|
|
111
|
+
.describe("Disclosed quantity"),
|
|
112
|
+
triggerprice: z
|
|
113
|
+
.string()
|
|
114
|
+
.regex(/^\d+(\.\d+)?$/, "Must be a decimal number")
|
|
115
|
+
.describe("Price at which the order triggers"),
|
|
116
|
+
timeperiod: z
|
|
117
|
+
.string()
|
|
118
|
+
.regex(/^\d+$/, "Must be a positive integer")
|
|
119
|
+
.describe("Validity in days (e.g. 365)"),
|
|
120
|
+
force: z.boolean().optional().describe("Set true to bypass soft quantity/value limits"),
|
|
121
|
+
},
|
|
122
|
+
}, async (params) => {
|
|
123
|
+
try {
|
|
124
|
+
const qty = Number(params.qty);
|
|
125
|
+
const price = Number(params.price);
|
|
126
|
+
const guard = validateOrderLimits(config, qty, price, params.force ?? false);
|
|
127
|
+
if (!guard.allowed) {
|
|
128
|
+
return {
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: "text",
|
|
132
|
+
text: JSON.stringify({ success: false, error: guard.error }),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
isError: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const { force: _, ...gttParams } = params;
|
|
139
|
+
const data = await api.modifyGttRule(gttParams);
|
|
140
|
+
return {
|
|
141
|
+
content: [
|
|
142
|
+
{
|
|
143
|
+
type: "text",
|
|
144
|
+
text: JSON.stringify({
|
|
145
|
+
success: true,
|
|
146
|
+
message: `GTT rule ${params.id} modified`,
|
|
147
|
+
data,
|
|
148
|
+
}, null, 2),
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
return {
|
|
155
|
+
content: [
|
|
156
|
+
{
|
|
157
|
+
type: "text",
|
|
158
|
+
text: JSON.stringify({
|
|
159
|
+
success: false,
|
|
160
|
+
error: error instanceof Error ? error.message : String(error),
|
|
161
|
+
}),
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
isError: true,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
server.registerTool("cancel_gtt_rule", {
|
|
169
|
+
description: "Cancel an existing GTT rule by ID.",
|
|
170
|
+
annotations: { destructiveHint: true, openWorldHint: true },
|
|
171
|
+
inputSchema: {
|
|
172
|
+
id: z.string().describe("GTT rule ID to cancel"),
|
|
173
|
+
symboltoken: z.string().describe("Symbol token"),
|
|
174
|
+
exchange: z.enum(["NSE", "BSE", "NFO", "MCX", "BFO", "CDS"]).describe("Exchange"),
|
|
175
|
+
},
|
|
176
|
+
}, async (params) => {
|
|
177
|
+
try {
|
|
178
|
+
await api.cancelGttRule(params);
|
|
179
|
+
return {
|
|
180
|
+
content: [
|
|
181
|
+
{
|
|
182
|
+
type: "text",
|
|
183
|
+
text: JSON.stringify({
|
|
184
|
+
success: true,
|
|
185
|
+
message: `GTT rule ${params.id} cancelled`,
|
|
186
|
+
}),
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
return {
|
|
193
|
+
content: [
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
text: JSON.stringify({
|
|
197
|
+
success: false,
|
|
198
|
+
error: error instanceof Error ? error.message : String(error),
|
|
199
|
+
}),
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
isError: true,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
server.registerTool("get_gtt_rule_details", {
|
|
207
|
+
description: "Get details of a specific GTT rule by ID.",
|
|
208
|
+
annotations: { openWorldHint: true },
|
|
209
|
+
inputSchema: {
|
|
210
|
+
id: z.string().describe("GTT rule ID"),
|
|
211
|
+
},
|
|
212
|
+
}, async (params) => {
|
|
213
|
+
try {
|
|
214
|
+
const data = await api.getGttRuleDetails(params);
|
|
215
|
+
return {
|
|
216
|
+
content: [
|
|
217
|
+
{
|
|
218
|
+
type: "text",
|
|
219
|
+
text: JSON.stringify({ success: true, data }, null, 2),
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
return {
|
|
226
|
+
content: [
|
|
227
|
+
{
|
|
228
|
+
type: "text",
|
|
229
|
+
text: JSON.stringify({
|
|
230
|
+
success: false,
|
|
231
|
+
error: error instanceof Error ? error.message : String(error),
|
|
232
|
+
}),
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
isError: true,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
server.registerTool("get_gtt_rule_list", {
|
|
240
|
+
description: "List GTT rules filtered by status. Returns paginated results.",
|
|
241
|
+
annotations: { openWorldHint: true },
|
|
242
|
+
inputSchema: {
|
|
243
|
+
status: z
|
|
244
|
+
.string()
|
|
245
|
+
.describe("Comma-separated statuses: FORALL, NEW, ACTIVE, SENTTOEXCHANGE, CANCELLED"),
|
|
246
|
+
page: z.string().describe("Page number (e.g. 1)"),
|
|
247
|
+
count: z.string().describe("Number of rules per page (e.g. 10)"),
|
|
248
|
+
},
|
|
249
|
+
}, async (params) => {
|
|
250
|
+
try {
|
|
251
|
+
const statusArr = params.status.split(",").map((s) => s.trim());
|
|
252
|
+
const page = Number(params.page);
|
|
253
|
+
const count = Number(params.count);
|
|
254
|
+
if (isNaN(page) || isNaN(count) || page < 1 || count < 1) {
|
|
255
|
+
return {
|
|
256
|
+
content: [
|
|
257
|
+
{
|
|
258
|
+
type: "text",
|
|
259
|
+
text: JSON.stringify({
|
|
260
|
+
success: false,
|
|
261
|
+
error: "page and count must be positive numbers",
|
|
262
|
+
}),
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
isError: true,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const data = await api.getGttRuleList({
|
|
269
|
+
status: statusArr,
|
|
270
|
+
page,
|
|
271
|
+
count,
|
|
272
|
+
});
|
|
273
|
+
return {
|
|
274
|
+
content: [
|
|
275
|
+
{
|
|
276
|
+
type: "text",
|
|
277
|
+
text: JSON.stringify({ success: true, data }, null, 2),
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
return {
|
|
284
|
+
content: [
|
|
285
|
+
{
|
|
286
|
+
type: "text",
|
|
287
|
+
text: JSON.stringify({
|
|
288
|
+
success: false,
|
|
289
|
+
error: error instanceof Error ? error.message : String(error),
|
|
290
|
+
}),
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
isError: true,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { AngelOneAPI } from "../api.js";
|
|
3
|
+
import type { SafetyConfig } from "../config.js";
|
|
4
|
+
export declare function registerAllTools(server: McpServer, api: AngelOneAPI, config: SafetyConfig): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { registerAuthTools } from "../tools/auth.js";
|
|
2
|
+
import { registerCalculatorTools } from "../tools/calculator.js";
|
|
3
|
+
import { registerGttTools } from "../tools/gtt.js";
|
|
4
|
+
import { registerMarketTools } from "../tools/market.js";
|
|
5
|
+
import { registerOrderTools } from "../tools/orders.js";
|
|
6
|
+
import { registerPortfolioTools } from "../tools/portfolio.js";
|
|
7
|
+
import { registerUserTools } from "../tools/user.js";
|
|
8
|
+
export function registerAllTools(server, api, config) {
|
|
9
|
+
registerAuthTools(server, api);
|
|
10
|
+
registerUserTools(server, api);
|
|
11
|
+
registerPortfolioTools(server, api, config);
|
|
12
|
+
registerOrderTools(server, api, config);
|
|
13
|
+
registerMarketTools(server, api);
|
|
14
|
+
registerGttTools(server, api, config);
|
|
15
|
+
registerCalculatorTools(server, api);
|
|
16
|
+
}
|