Skip to content

Commit e389d6b

Browse files
committed
Support mcp tool calls
1 parent b85c5f5 commit e389d6b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

eca-chat.el

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ Must be a valid model supported by server, check `eca-chat-select-model`."
8282
"Face for the system messages in chat."
8383
:group 'eca)
8484

85+
(defface eca-chat-mcp-tool-call-face
86+
'((t :inherit font-lock-keyword-face))
87+
"Face for the MCP tool calls in chat."
88+
:group 'eca)
89+
90+
(defface eca-chat-mcp-tool-call-name-face
91+
'((t :inherit eca-chat-mcp-tool-call-face :underline t))
92+
"Face for the MCP tool calls's name in chat."
93+
:group 'eca)
94+
8595
(defface eca-chat-welcome-face
8696
'((t :inherit font-lock-builtin-face))
8797
"Face for the welcome message in chat."
@@ -116,6 +126,7 @@ Must be a valid model supported by server, check `eca-chat-select-model`."
116126
(define-key map (kbd "DEL") #'eca-chat--backward-delete-char)
117127
(define-key map (kbd "S-<return>") #'eca-chat--send-newline)
118128
(define-key map (kbd "S-<return>") #'eca-chat--send-newline)
129+
(define-key map (kbd "C-k") #'eca-chat-clear)
119130
(define-key map (kbd "<return>") #'eca-chat--send-return)
120131
map)
121132
"Keymap used by `eca-chat-mode'.")
@@ -489,6 +500,15 @@ This is similar to `backward-delete-char' but protects the prompt/context line."
489500
'font-lock-face 'eca-chat-system-messages-face))))
490501
(_ (progn
491502
(eca-chat--add-content text))))))
503+
("mcpToolCall" (let ((name (plist-get content :name)))
504+
(eca-chat--add-content
505+
(format (propertize "%s %s\n"
506+
'line-spacing 10)
507+
(propertize "Calling MCP tool"
508+
'line-prefix (propertize eca-chat-prompt-prefix 'font-lock-face 'eca-chat-mcp-tool-call-face)
509+
'font-lock-face 'eca-chat-mcp-tool-call-face)
510+
(propertize name
511+
'font-lock-face 'eca-chat-mcp-tool-call-name-face)))))
492512
("progress" (pcase state
493513
("running" (progn
494514
(unless eca-chat--spinner-timer

0 commit comments

Comments
 (0)