sketch/mcp: increase connection and tool timeouts
diff --git a/mcp/client.go b/mcp/client.go
index d15ae84..8f65614 100644
--- a/mcp/client.go
+++ b/mcp/client.go
@@ -15,6 +15,14 @@
"sketch.dev/llm"
)
+const (
+ // DefaultMCPConnectionTimeout is the default timeout for connecting to MCP servers
+ DefaultMCPConnectionTimeout = 120 * time.Second
+
+ // DefaultMCPToolTimeout is the default timeout for executing MCP tool calls
+ DefaultMCPToolTimeout = 120 * time.Second
+)
+
// ServerConfig represents the configuration for an MCP server
type ServerConfig struct {
Name string `json:"name,omitempty"`
@@ -297,7 +305,7 @@
func (m *MCPManager) executeMCPTool(ctx context.Context, mcpClient *client.Client, toolName string, input json.RawMessage) (any, error) {
// Add timeout for tool execution
// TODO: Expose the timeout as a tool call argument.
- ctxWithTimeout, cancel := context.WithTimeout(ctx, 120*time.Second)
+ ctxWithTimeout, cancel := context.WithTimeout(ctx, DefaultMCPToolTimeout)
defer cancel()
// Parse input arguments