-
Notifications
You must be signed in to change notification settings - Fork 306
feat: adding agent tool for mcp server #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Greptile OverviewGreptile SummaryThis PR adds a new Key changes:
Issue found:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant MCP Server
participant Context
participant SessionManager
participant Stagehand
participant Agent
participant Gemini API
User->>MCP Server: Call browserbase_stagehand_agent tool
MCP Server->>Context: run(agentTool, {prompt})
Context->>Context: handle(context, params)
Context->>Context: getStagehand()
Context->>SessionManager: getSession(sessionId, config)
SessionManager-->>Context: return session.stagehand
Context->>Stagehand: agent({cua: true, model: {...}})
Stagehand-->>Context: return agent instance
Context->>Agent: execute({instruction, maxSteps: 20})
loop Up to 20 steps
Agent->>Gemini API: Computer Use API calls
Gemini API->>Agent: Navigation/interaction commands
Agent->>Stagehand: Perform browser actions
end
Agent-->>Context: return result
Context->>MCP Server: return {content: [{type: "text", text: result}]}
MCP Server-->>User: Agent execution completed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 files reviewed, 1 comment
src/tools/agent.ts
Outdated
| apiKey: | ||
| process.env.GOOGLE_GENERATIVE_AI_API_KEY || | ||
| process.env.GOOGLE_API_KEY || | ||
| process.env.GEMINI_API_KEY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: missing validation - if all env vars are undefined, the agent will be created with undefined and fail at runtime when executing
validate the resolved value is not undefined before passing to agent constructor
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/tools/agent.ts
Line: 44:47
Comment:
**logic:** missing validation - if all env vars are undefined, the agent will be created with `undefined` and fail at runtime when executing
validate the resolved value is not `undefined` before passing to agent constructor
How can I resolve this? If you propose a fix, please make it concise.
what
adding agent tool to our mcp