@rohithvemulapally/mcp-server-salesforce 0.0.6
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 +357 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +312 -0
- package/dist/tools/aggregateQuery.d.ts +18 -0
- package/dist/tools/aggregateQuery.js +250 -0
- package/dist/tools/describe.d.ts +9 -0
- package/dist/tools/describe.js +33 -0
- package/dist/tools/dml.d.ts +15 -0
- package/dist/tools/dml.js +105 -0
- package/dist/tools/executeAnonymous.d.ts +25 -0
- package/dist/tools/executeAnonymous.js +130 -0
- package/dist/tools/manageDebugLogs.d.ts +30 -0
- package/dist/tools/manageDebugLogs.js +424 -0
- package/dist/tools/manageField.d.ts +32 -0
- package/dist/tools/manageField.js +349 -0
- package/dist/tools/manageFieldPermissions.d.ts +17 -0
- package/dist/tools/manageFieldPermissions.js +247 -0
- package/dist/tools/manageObject.d.ts +20 -0
- package/dist/tools/manageObject.js +138 -0
- package/dist/tools/metadata.d.ts +9 -0
- package/dist/tools/metadata.js +66 -0
- package/dist/tools/query.d.ts +16 -0
- package/dist/tools/query.js +114 -0
- package/dist/tools/readApex.d.ts +26 -0
- package/dist/tools/readApex.js +165 -0
- package/dist/tools/readApexTrigger.d.ts +26 -0
- package/dist/tools/readApexTrigger.js +165 -0
- package/dist/tools/search.d.ts +9 -0
- package/dist/tools/search.js +45 -0
- package/dist/tools/searchAll.d.ts +29 -0
- package/dist/tools/searchAll.js +250 -0
- package/dist/tools/writeApex.d.ts +27 -0
- package/dist/tools/writeApex.js +154 -0
- package/dist/tools/writeApexTrigger.d.ts +28 -0
- package/dist/tools/writeApexTrigger.js +178 -0
- package/dist/types/connection.d.ts +52 -0
- package/dist/types/connection.js +21 -0
- package/dist/types/metadata.d.ts +43 -0
- package/dist/types/metadata.js +1 -0
- package/dist/types/salesforce.d.ts +33 -0
- package/dist/types/salesforce.js +1 -0
- package/dist/utils/connection.d.ts +7 -0
- package/dist/utils/connection.js +172 -0
- package/dist/utils/errorHandler.d.ts +15 -0
- package/dist/utils/errorHandler.js +23 -0
- package/package.json +39 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
export const MANAGE_DEBUG_LOGS = {
|
|
2
|
+
name: "salesforce_manage_debug_logs",
|
|
3
|
+
description: `Manage debug logs for Salesforce users - enable, disable, or retrieve logs.
|
|
4
|
+
|
|
5
|
+
Examples:
|
|
6
|
+
1. Enable debug logs for a user:
|
|
7
|
+
{
|
|
8
|
+
"operation": "enable",
|
|
9
|
+
"username": "user@example.com",
|
|
10
|
+
"logLevel": "DEBUG",
|
|
11
|
+
"expirationTime": 30
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
2. Disable debug logs for a user:
|
|
15
|
+
{
|
|
16
|
+
"operation": "disable",
|
|
17
|
+
"username": "user@example.com"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
3. Retrieve debug logs for a user:
|
|
21
|
+
{
|
|
22
|
+
"operation": "retrieve",
|
|
23
|
+
"username": "user@example.com",
|
|
24
|
+
"limit": 5
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
4. Retrieve a specific log with full content:
|
|
28
|
+
{
|
|
29
|
+
"operation": "retrieve",
|
|
30
|
+
"username": "user@example.com",
|
|
31
|
+
"logId": "07L1g000000XXXXEAA0",
|
|
32
|
+
"includeBody": true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Notes:
|
|
36
|
+
- The operation must be one of: 'enable', 'disable', or 'retrieve'
|
|
37
|
+
- The username parameter is required for all operations
|
|
38
|
+
- For 'enable' operation, logLevel is optional (defaults to 'DEBUG')
|
|
39
|
+
- Log levels: NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST
|
|
40
|
+
- expirationTime is optional for 'enable' operation (minutes until expiration, defaults to 30)
|
|
41
|
+
- limit is optional for 'retrieve' operation (maximum number of logs to return, defaults to 10)
|
|
42
|
+
- logId is optional for 'retrieve' operation (to get a specific log)
|
|
43
|
+
- includeBody is optional for 'retrieve' operation (to include the full log content, defaults to false)
|
|
44
|
+
- The tool validates that the specified user exists before performing operations
|
|
45
|
+
- If logLevel is not specified when enabling logs, the tool will ask for clarification`,
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
operation: {
|
|
50
|
+
type: "string",
|
|
51
|
+
enum: ["enable", "disable", "retrieve"],
|
|
52
|
+
description: "Operation to perform on debug logs"
|
|
53
|
+
},
|
|
54
|
+
username: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "Username of the Salesforce user"
|
|
57
|
+
},
|
|
58
|
+
logLevel: {
|
|
59
|
+
type: "string",
|
|
60
|
+
enum: ["NONE", "ERROR", "WARN", "INFO", "DEBUG", "FINE", "FINER", "FINEST"],
|
|
61
|
+
description: "Log level for debug logs (required for 'enable' operation)"
|
|
62
|
+
},
|
|
63
|
+
expirationTime: {
|
|
64
|
+
type: "number",
|
|
65
|
+
description: "Minutes until the debug log configuration expires (optional, defaults to 30)"
|
|
66
|
+
},
|
|
67
|
+
limit: {
|
|
68
|
+
type: "number",
|
|
69
|
+
description: "Maximum number of logs to retrieve (optional, defaults to 10)"
|
|
70
|
+
},
|
|
71
|
+
logId: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "ID of a specific log to retrieve (optional)"
|
|
74
|
+
},
|
|
75
|
+
includeBody: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Whether to include the full log content (optional, defaults to false)"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
required: ["operation", "username"]
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Handles managing debug logs for Salesforce users
|
|
85
|
+
* @param conn Active Salesforce connection
|
|
86
|
+
* @param args Arguments for managing debug logs
|
|
87
|
+
* @returns Tool response with operation results
|
|
88
|
+
*/
|
|
89
|
+
export async function handleManageDebugLogs(conn, args) {
|
|
90
|
+
try {
|
|
91
|
+
// Validate inputs
|
|
92
|
+
if (!args.username) {
|
|
93
|
+
throw new Error('username is required');
|
|
94
|
+
}
|
|
95
|
+
// Determine if the input is likely a username or a full name
|
|
96
|
+
const isLikelyUsername = args.username.includes('@') || !args.username.includes(' ');
|
|
97
|
+
// Build the query based on whether the input looks like a username or a full name
|
|
98
|
+
let userQuery;
|
|
99
|
+
if (isLikelyUsername) {
|
|
100
|
+
// Query by username
|
|
101
|
+
userQuery = await conn.query(`
|
|
102
|
+
SELECT Id, Username, Name, IsActive
|
|
103
|
+
FROM User
|
|
104
|
+
WHERE Username = '${args.username}'
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// Query by full name
|
|
109
|
+
userQuery = await conn.query(`
|
|
110
|
+
SELECT Id, Username, Name, IsActive
|
|
111
|
+
FROM User
|
|
112
|
+
WHERE Name LIKE '%${args.username}%'
|
|
113
|
+
ORDER BY LastModifiedDate DESC
|
|
114
|
+
LIMIT 5
|
|
115
|
+
`);
|
|
116
|
+
}
|
|
117
|
+
if (userQuery.records.length === 0) {
|
|
118
|
+
// If no results with the initial query, try a more flexible search
|
|
119
|
+
userQuery = await conn.query(`
|
|
120
|
+
SELECT Id, Username, Name, IsActive
|
|
121
|
+
FROM User
|
|
122
|
+
WHERE Name LIKE '%${args.username}%'
|
|
123
|
+
OR Username LIKE '%${args.username}%'
|
|
124
|
+
ORDER BY LastModifiedDate DESC
|
|
125
|
+
LIMIT 5
|
|
126
|
+
`);
|
|
127
|
+
if (userQuery.records.length === 0) {
|
|
128
|
+
return {
|
|
129
|
+
content: [{
|
|
130
|
+
type: "text",
|
|
131
|
+
text: `Error: No user found matching '${args.username}'. Please verify the username or full name and try again.`
|
|
132
|
+
}],
|
|
133
|
+
isError: true,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// If multiple users found, ask for clarification
|
|
137
|
+
if (userQuery.records.length > 1) {
|
|
138
|
+
let responseText = `Multiple users found matching '${args.username}'. Please specify which user by providing the exact username:\n\n`;
|
|
139
|
+
userQuery.records.forEach((user) => {
|
|
140
|
+
responseText += `- **${user.Name}** (${user.Username})\n`;
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
content: [{
|
|
144
|
+
type: "text",
|
|
145
|
+
text: responseText
|
|
146
|
+
}]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const user = userQuery.records[0];
|
|
151
|
+
if (!user.IsActive) {
|
|
152
|
+
return {
|
|
153
|
+
content: [{
|
|
154
|
+
type: "text",
|
|
155
|
+
text: `Warning: User '${args.username}' exists but is inactive. Debug logs may not be generated for inactive users.`
|
|
156
|
+
}]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// Handle operations
|
|
160
|
+
switch (args.operation) {
|
|
161
|
+
case 'enable': {
|
|
162
|
+
// If logLevel is not provided, we need to ask for it
|
|
163
|
+
if (!args.logLevel) {
|
|
164
|
+
return {
|
|
165
|
+
content: [{
|
|
166
|
+
type: "text",
|
|
167
|
+
text: `Please specify a log level for enabling debug logs. Valid options are: NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST.`
|
|
168
|
+
}],
|
|
169
|
+
isError: true,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// Set default expiration time if not provided
|
|
173
|
+
const expirationTime = args.expirationTime || 30;
|
|
174
|
+
// Check if a trace flag already exists for this user
|
|
175
|
+
const existingTraceFlag = await conn.tooling.query(`
|
|
176
|
+
SELECT Id, DebugLevelId FROM TraceFlag
|
|
177
|
+
WHERE TracedEntityId = '${user.Id}'
|
|
178
|
+
AND ExpirationDate > ${new Date().toISOString()}
|
|
179
|
+
`);
|
|
180
|
+
let traceFlagId;
|
|
181
|
+
let debugLevelId;
|
|
182
|
+
let operation;
|
|
183
|
+
// Calculate expiration date
|
|
184
|
+
const expirationDate = new Date();
|
|
185
|
+
expirationDate.setMinutes(expirationDate.getMinutes() + expirationTime);
|
|
186
|
+
if (existingTraceFlag.records.length > 0) {
|
|
187
|
+
// Update existing trace flag
|
|
188
|
+
traceFlagId = existingTraceFlag.records[0].Id;
|
|
189
|
+
debugLevelId = existingTraceFlag.records[0].DebugLevelId;
|
|
190
|
+
await conn.tooling.sobject('TraceFlag').update({
|
|
191
|
+
Id: traceFlagId,
|
|
192
|
+
LogType: 'USER_DEBUG',
|
|
193
|
+
StartDate: new Date().toISOString(),
|
|
194
|
+
ExpirationDate: expirationDate.toISOString()
|
|
195
|
+
});
|
|
196
|
+
operation = 'updated';
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// Create a new debug level with the correct field names
|
|
200
|
+
const debugLevelResult = await conn.tooling.sobject('DebugLevel').create({
|
|
201
|
+
DeveloperName: `UserDebug_${Date.now()}`,
|
|
202
|
+
MasterLabel: `User Debug ${user.Username}`,
|
|
203
|
+
ApexCode: args.logLevel,
|
|
204
|
+
ApexProfiling: args.logLevel,
|
|
205
|
+
Callout: args.logLevel,
|
|
206
|
+
Database: args.logLevel,
|
|
207
|
+
System: args.logLevel,
|
|
208
|
+
Validation: args.logLevel,
|
|
209
|
+
Visualforce: args.logLevel,
|
|
210
|
+
Workflow: args.logLevel
|
|
211
|
+
});
|
|
212
|
+
debugLevelId = debugLevelResult.id;
|
|
213
|
+
// Create a new trace flag
|
|
214
|
+
const traceFlagResult = await conn.tooling.sobject('TraceFlag').create({
|
|
215
|
+
TracedEntityId: user.Id,
|
|
216
|
+
DebugLevelId: debugLevelId,
|
|
217
|
+
LogType: 'USER_DEBUG',
|
|
218
|
+
StartDate: new Date().toISOString(),
|
|
219
|
+
ExpirationDate: expirationDate.toISOString()
|
|
220
|
+
});
|
|
221
|
+
traceFlagId = traceFlagResult.id;
|
|
222
|
+
operation = 'enabled';
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
content: [{
|
|
226
|
+
type: "text",
|
|
227
|
+
text: `Successfully ${operation} debug logs for user '${args.username}'.\n\n` +
|
|
228
|
+
`**Log Level:** ${args.logLevel}\n` +
|
|
229
|
+
`**Expiration:** ${expirationDate.toLocaleString()} (${expirationTime} minutes from now)\n` +
|
|
230
|
+
`**Trace Flag ID:** ${traceFlagId}`
|
|
231
|
+
}]
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
case 'disable': {
|
|
235
|
+
// Find all active trace flags for this user
|
|
236
|
+
const traceFlags = await conn.tooling.query(`
|
|
237
|
+
SELECT Id FROM TraceFlag WHERE TracedEntityId = '${user.Id}' AND ExpirationDate > ${new Date().toISOString()}
|
|
238
|
+
`);
|
|
239
|
+
if (traceFlags.records.length === 0) {
|
|
240
|
+
return {
|
|
241
|
+
content: [{
|
|
242
|
+
type: "text",
|
|
243
|
+
text: `No active debug logs found for user '${args.username}'.`
|
|
244
|
+
}]
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
// Delete trace flags instead of updating expiration date
|
|
249
|
+
const traceFlagIds = traceFlags.records.map((tf) => tf.Id);
|
|
250
|
+
const deleteResults = await Promise.all(traceFlagIds.map((id) => conn.tooling.sobject('TraceFlag').delete(id)));
|
|
251
|
+
return {
|
|
252
|
+
content: [{
|
|
253
|
+
type: "text",
|
|
254
|
+
text: `Successfully disabled ${traceFlagIds.length} debug log configuration(s) for user '${args.username}' by removing them.`
|
|
255
|
+
}]
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
catch (deleteError) {
|
|
259
|
+
console.error('Error deleting trace flags:', deleteError);
|
|
260
|
+
// Fallback to setting a future expiration date if delete fails
|
|
261
|
+
try {
|
|
262
|
+
// Set expiration date to 5 minutes in the future to satisfy Salesforce's requirement
|
|
263
|
+
const nearFutureExpiration = new Date();
|
|
264
|
+
nearFutureExpiration.setMinutes(nearFutureExpiration.getMinutes() + 5);
|
|
265
|
+
const traceFlagIds = traceFlags.records.map((tf) => tf.Id);
|
|
266
|
+
const updateResults = await Promise.all(traceFlagIds.map((id) => conn.tooling.sobject('TraceFlag').update({
|
|
267
|
+
Id: id,
|
|
268
|
+
ExpirationDate: nearFutureExpiration.toISOString()
|
|
269
|
+
})));
|
|
270
|
+
return {
|
|
271
|
+
content: [{
|
|
272
|
+
type: "text",
|
|
273
|
+
text: `Successfully disabled ${traceFlagIds.length} debug log configuration(s) for user '${args.username}'. They will expire in 5 minutes.`
|
|
274
|
+
}]
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
catch (updateError) {
|
|
278
|
+
console.error('Error updating trace flags:', updateError);
|
|
279
|
+
throw new Error(`Could not disable debug logs: ${deleteError instanceof Error ? deleteError.message : String(deleteError)}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
case 'retrieve': {
|
|
284
|
+
// Set default limit if not provided
|
|
285
|
+
const limit = args.limit || 10;
|
|
286
|
+
// If a specific log ID is provided, retrieve that log directly
|
|
287
|
+
if (args.logId) {
|
|
288
|
+
try {
|
|
289
|
+
// First check if the log exists
|
|
290
|
+
const logQuery = await conn.tooling.query(`
|
|
291
|
+
SELECT Id, LogUserId, Operation, Application, Status, LogLength, LastModifiedDate, Request
|
|
292
|
+
FROM ApexLog
|
|
293
|
+
WHERE Id = '${args.logId}'
|
|
294
|
+
`);
|
|
295
|
+
if (logQuery.records.length === 0) {
|
|
296
|
+
return {
|
|
297
|
+
content: [{
|
|
298
|
+
type: "text",
|
|
299
|
+
text: `No log found with ID '${args.logId}'.`
|
|
300
|
+
}]
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
const log = logQuery.records[0];
|
|
304
|
+
// If includeBody is true, retrieve the log body
|
|
305
|
+
if (args.includeBody) {
|
|
306
|
+
try {
|
|
307
|
+
// Retrieve the log body
|
|
308
|
+
const logBody = await conn.tooling.request({
|
|
309
|
+
method: 'GET',
|
|
310
|
+
url: `${conn.instanceUrl}/services/data/v58.0/tooling/sobjects/ApexLog/${log.Id}/Body`
|
|
311
|
+
});
|
|
312
|
+
let responseText = `**Log Details:**\n\n`;
|
|
313
|
+
responseText += `- **ID:** ${log.Id}\n`;
|
|
314
|
+
responseText += `- **Operation:** ${log.Operation}\n`;
|
|
315
|
+
responseText += `- **Application:** ${log.Application}\n`;
|
|
316
|
+
responseText += `- **Status:** ${log.Status}\n`;
|
|
317
|
+
responseText += `- **Size:** ${log.LogLength} bytes\n`;
|
|
318
|
+
responseText += `- **Date:** ${new Date(log.LastModifiedDate).toLocaleString()}\n\n`;
|
|
319
|
+
responseText += `**Log Body:**\n\`\`\`\n${logBody}\n\`\`\`\n`;
|
|
320
|
+
return {
|
|
321
|
+
content: [{
|
|
322
|
+
type: "text",
|
|
323
|
+
text: responseText
|
|
324
|
+
}]
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
catch (logError) {
|
|
328
|
+
console.error('Error retrieving log body:', logError);
|
|
329
|
+
return {
|
|
330
|
+
content: [{
|
|
331
|
+
type: "text",
|
|
332
|
+
text: `Error retrieving log body: ${logError instanceof Error ? logError.message : String(logError)}`
|
|
333
|
+
}],
|
|
334
|
+
isError: true
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
// Just return the log metadata
|
|
340
|
+
let responseText = `**Log Details:**\n\n`;
|
|
341
|
+
responseText += `- **ID:** ${log.Id}\n`;
|
|
342
|
+
responseText += `- **Operation:** ${log.Operation}\n`;
|
|
343
|
+
responseText += `- **Application:** ${log.Application}\n`;
|
|
344
|
+
responseText += `- **Status:** ${log.Status}\n`;
|
|
345
|
+
responseText += `- **Size:** ${log.LogLength} bytes\n`;
|
|
346
|
+
responseText += `- **Date:** ${new Date(log.LastModifiedDate).toLocaleString()}\n\n`;
|
|
347
|
+
responseText += `To view the full log content, add "includeBody": true to your request.`;
|
|
348
|
+
return {
|
|
349
|
+
content: [{
|
|
350
|
+
type: "text",
|
|
351
|
+
text: responseText
|
|
352
|
+
}]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
console.error('Error retrieving log:', error);
|
|
358
|
+
return {
|
|
359
|
+
content: [{
|
|
360
|
+
type: "text",
|
|
361
|
+
text: `Error retrieving log: ${error instanceof Error ? error.message : String(error)}`
|
|
362
|
+
}],
|
|
363
|
+
isError: true,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// Query for logs
|
|
368
|
+
const logs = await conn.tooling.query(`
|
|
369
|
+
SELECT Id, LogUserId, Operation, Application, Status, LogLength, LastModifiedDate, Request
|
|
370
|
+
FROM ApexLog
|
|
371
|
+
WHERE LogUserId = '${user.Id}'
|
|
372
|
+
ORDER BY LastModifiedDate DESC
|
|
373
|
+
LIMIT ${limit}
|
|
374
|
+
`);
|
|
375
|
+
if (logs.records.length === 0) {
|
|
376
|
+
return {
|
|
377
|
+
content: [{
|
|
378
|
+
type: "text",
|
|
379
|
+
text: `No debug logs found for user '${args.username}'.`
|
|
380
|
+
}]
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
// Format log information
|
|
384
|
+
let responseText = `Found ${logs.records.length} debug logs for user '${args.username}':\n\n`;
|
|
385
|
+
for (let i = 0; i < logs.records.length; i++) {
|
|
386
|
+
const log = logs.records[i];
|
|
387
|
+
responseText += `**Log ${i + 1}**\n`;
|
|
388
|
+
responseText += `- **ID:** ${log.Id}\n`;
|
|
389
|
+
responseText += `- **Operation:** ${log.Operation}\n`;
|
|
390
|
+
responseText += `- **Application:** ${log.Application}\n`;
|
|
391
|
+
responseText += `- **Status:** ${log.Status}\n`;
|
|
392
|
+
responseText += `- **Size:** ${log.LogLength} bytes\n`;
|
|
393
|
+
responseText += `- **Date:** ${new Date(log.LastModifiedDate).toLocaleString()}\n\n`;
|
|
394
|
+
}
|
|
395
|
+
// Add a note about viewing specific logs with full content
|
|
396
|
+
responseText += `To view a specific log with full content, use:\n\`\`\`\n`;
|
|
397
|
+
responseText += `{\n`;
|
|
398
|
+
responseText += ` "operation": "retrieve",\n`;
|
|
399
|
+
responseText += ` "username": "${args.username}",\n`;
|
|
400
|
+
responseText += ` "logId": "<LOG_ID>",\n`;
|
|
401
|
+
responseText += ` "includeBody": true\n`;
|
|
402
|
+
responseText += `}\n\`\`\`\n`;
|
|
403
|
+
return {
|
|
404
|
+
content: [{
|
|
405
|
+
type: "text",
|
|
406
|
+
text: responseText
|
|
407
|
+
}]
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
default:
|
|
411
|
+
throw new Error(`Invalid operation: ${args.operation}. Must be 'enable', 'disable', or 'retrieve'.`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
console.error('Error managing debug logs:', error);
|
|
416
|
+
return {
|
|
417
|
+
content: [{
|
|
418
|
+
type: "text",
|
|
419
|
+
text: `Error managing debug logs: ${error instanceof Error ? error.message : String(error)}`
|
|
420
|
+
}],
|
|
421
|
+
isError: true,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
export declare const MANAGE_FIELD: Tool;
|
|
3
|
+
export interface ManageFieldArgs {
|
|
4
|
+
operation: 'create' | 'update';
|
|
5
|
+
objectName: string;
|
|
6
|
+
fieldName: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
unique?: boolean;
|
|
11
|
+
externalId?: boolean;
|
|
12
|
+
length?: number;
|
|
13
|
+
precision?: number;
|
|
14
|
+
scale?: number;
|
|
15
|
+
referenceTo?: string;
|
|
16
|
+
relationshipLabel?: string;
|
|
17
|
+
relationshipName?: string;
|
|
18
|
+
deleteConstraint?: 'Cascade' | 'Restrict' | 'SetNull';
|
|
19
|
+
picklistValues?: Array<{
|
|
20
|
+
label: string;
|
|
21
|
+
isDefault?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
description?: string;
|
|
24
|
+
grantAccessTo?: string[];
|
|
25
|
+
}
|
|
26
|
+
export declare function handleManageField(conn: any, args: ManageFieldArgs): Promise<{
|
|
27
|
+
content: {
|
|
28
|
+
type: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}[];
|
|
31
|
+
isError: boolean;
|
|
32
|
+
}>;
|