claude-code-emacs-mcp-server
Version:
MCP server for Claude Code Emacs integration
65 lines • 2.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleSendNotification = handleSendNotification;
async function handleSendNotification(bridge, args) {
if (!bridge.isConnected()) {
return {
content: [
{
type: 'text',
text: 'Error: Emacs is not connected'
}
],
status: 'error',
message: 'Emacs is not connected',
isError: true
};
}
try {
// Send notification to Emacs
const result = await bridge.request('sendNotification', {
title: args.title,
message: args.message
});
// Emacs returns { success: true, message: "Notification sent" }
// We need to convert it to { status: 'success', message: "..." }
const success = result.success === true;
if (!success) {
return {
content: [
{
type: 'text',
text: 'Failed to send notification'
}
],
status: 'error',
message: 'Failed to send notification',
isError: true
};
}
return {
content: [
{
type: 'text',
text: `Notification sent: "${args.title}"`
}
],
status: 'success',
message: 'Notification sent'
};
}
catch (error) {
return {
content: [
{
type: 'text',
text: `Error sending notification: ${error instanceof Error ? error.message : 'Unknown error'}`
}
],
status: 'error',
message: error instanceof Error ? error.message : 'Unknown error',
isError: true
};
}
}
//# sourceMappingURL=notification-tools.js.map