| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package agent
- import (
- "context"
- "github.com/opencode-ai/opencode/internal/history"
- "github.com/opencode-ai/opencode/internal/llm/tools"
- "github.com/opencode-ai/opencode/internal/lsp"
- "github.com/opencode-ai/opencode/internal/message"
- "github.com/opencode-ai/opencode/internal/permission"
- "github.com/opencode-ai/opencode/internal/session"
- )
- func CoderAgentTools(
- permissions permission.Service,
- sessions session.Service,
- messages message.Service,
- history history.Service,
- lspClients map[string]*lsp.Client,
- ) []tools.BaseTool {
- ctx := context.Background()
- otherTools := GetMcpTools(ctx, permissions)
- if len(lspClients) > 0 {
- otherTools = append(otherTools, tools.NewDiagnosticsTool(lspClients))
- }
- return append(
- []tools.BaseTool{
- tools.NewBashTool(permissions),
- tools.NewEditTool(lspClients, permissions, history),
- tools.NewFetchTool(permissions),
- tools.NewGlobTool(),
- tools.NewGrepTool(),
- tools.NewLsTool(),
- tools.NewSourcegraphTool(),
- tools.NewViewTool(lspClients),
- tools.NewPatchTool(lspClients, permissions, history),
- tools.NewWriteTool(lspClients, permissions, history),
- tools.NewConfigureLspServerTool(),
- NewAgentTool(sessions, messages, lspClients),
- }, otherTools...,
- )
- }
- func TaskAgentTools(lspClients map[string]*lsp.Client) []tools.BaseTool {
- return []tools.BaseTool{
- tools.NewGlobTool(),
- tools.NewGrepTool(),
- tools.NewLsTool(),
- tools.NewSourcegraphTool(),
- tools.NewViewTool(lspClients),
- }
- }
|