Skip to content

Commit c233abf

Browse files
authored
Merge branch 'main' into feat/per-project-hub
2 parents 195e5ed + 95c5abe commit c233abf

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

doc/extensions/avante.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,39 @@ require("avante").setup({
3030

3131
## Configure Avante Integration
3232

33-
By default, MCP server prompts will be available as `/mcp:server_name:prompt_name` in avante chat.
33+
By default, MCP server prompts will be available as `/mcp:server_name:prompt_name` in avante chat. If you are using `blink.cmp` then you also need to configure [`Kaiser-Yang/blink-cmp-avante`](https://github.com/Kaiser-Yang/blink-cmp-avante)
34+
35+
<details>
36+
<summary> Example blink.cmp configuration </summary>
37+
38+
```lua
39+
return {
40+
"saghen/blink.cmp",
41+
dependencies = {
42+
"Kaiser-Yang/blink-cmp-avante",
43+
},
44+
---@module 'blink.cmp'
45+
---@type blink.cmp.Config
46+
opts = {
47+
sources = {
48+
default = { "lsp", "avante", "path", "snippets", "buffer" },
49+
providers = {
50+
avante = {
51+
module = "blink-cmp-avante",
52+
name = "Avante",
53+
opts = {
54+
-- options for blink-cmp-avante
55+
},
56+
},
57+
},
58+
},
59+
}
60+
}
61+
```
62+
63+
</details>
64+
65+
3466

3567
```lua
3668
require("mcphub").setup({

lua/mcphub/extensions/avante/init.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ function M.mcp_tool()
9898
local shared = require("mcphub.extensions.shared")
9999
for action_name, schema in pairs(tool_schemas) do
100100
---@type AvanteLLMToolFunc<MCPHub.ToolCallArgs | MCPHub.ResourceAccessArgs>
101-
schema.func = function(args, on_log, on_complete)
101+
schema.func = function(args, opts)
102+
opts = opts or {}
103+
local on_complete = opts.on_complete or function() end
104+
local on_log = opts.on_log or function() end
102105
---@diagnostic disable-next-line: missing-parameter
103106
async.run(function()
104107
local hub = require("mcphub").get_hub_instance()
@@ -116,7 +119,7 @@ function M.mcp_tool()
116119
end
117120
local sidebar = require("avante").get()
118121
if params.action == "access_mcp_resource" then
119-
if on_log then
122+
if on_log and type(on_log) == "function" then
120123
on_log(
121124
string.format("Accessing `%s` resource from server `%s`", params.uri, params.server_name)
122125
)
@@ -134,7 +137,7 @@ function M.mcp_tool()
134137
end,
135138
})
136139
elseif params.action == "use_mcp_tool" then
137-
if on_log then
140+
if on_log and type(on_log) == "function" then
138141
on_log(
139142
string.format(
140143
"Calling tool `%s` on server `%s` with arguments: %s",

0 commit comments

Comments
 (0)