Skip to content

Commit 8527400

Browse files
committed
Added App_shell action to the edit-mcp.
1 parent 0d80558 commit 8527400

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎edit-mcp.js‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,37 @@ NEWACTION('App_write', {
243243

244244
});
245245

246+
NEWACTION('App_shell', {
247+
summary: 'Executes a shell command on the remote computer in the remote project root and returns its output or error. Use it to inspect the environment, run project commands, build, test, or manage the remote project.',
248+
input: '*cmd',
249+
output: 'response,error:String2',
250+
internal: 'mcp',
251+
action: async function($, model) {
252+
253+
// WS Client
254+
if (isPROXY) {
255+
const client = findclient($);
256+
if (client) {
257+
let id = GUID(10);
258+
client.callbacks[id] = $;
259+
client.send({ id: id, name: $.id, input: model });
260+
} else
261+
$.invalid(ERR_OFFLINE);
262+
return;
263+
}
264+
265+
try {
266+
const response = await SHELL(model.cmd, PATH.root());
267+
$.callback({ response: response });
268+
} catch (e) {
269+
$.callback({
270+
response: e.stdout || '',
271+
error: e.stderr || e.message || String(e)
272+
});
273+
}
274+
}
275+
});
276+
246277
NEWACTION('App_delete', {
247278
summary: 'Deletes a file or directory from the project. Use it only when the requested project change requires removing existing content.',
248279
input: '*path',

0 commit comments

Comments
 (0)