-
Hey thanks for the fabulous gptel. I was wondering if there is a standard way to have a preset connect to an mcp tool and disconnect after the completion is finished. I tried to do define the preset with
but it doesn't enable them in time and the @preset completion fails to use the tool. Some of the mcp contains many tools and adding them all globally will just confuse the model. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
A couple of misconceptions here.
To solve your timing issue, you just have to start the MCP server synchronously. :pre (lambda () (gptel-mcp-connect '("mcptool") 'sync)) You can set the specific tools you want with (Be sure to update the gptel and mcp packages before you try this.) To solve the adding-tools-globally issue... there is nothing to solve. When you use @preset, all changes happen in a buffer-local environment. If you activate this preset from the transient menu, you are explicitly requesting some/all tools to be included. |
Beta Was this translation helpful? Give feedback.
A couple of misconceptions here.
:pre
runs before setting the variables defined in the preset,:post
runs after. Both these things happen when the preset is applied, well before the request is sent. So:post
doesn't do what you think.The tools that are sent with a request to an LLM depend only on
gptel-tools
, whose value you can set in many ways (transient menu, elisp) and is not controlled by what MCP servers are connected.To solve your timing issue, you just have to start the MCP server synchronously.
You can set the specific tools you want with
:tools
in the preset, as usual.(Be sure to update the gptel and mcp packages b…