-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(copilot): add context7 #2779
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
base: staging
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR adds a new copilot tool called What ChangedNew Files Created:
Modified Files:
Implementation DetailsThe tool accepts three parameters:
The server implementation uses a dual-API strategy:
Search queries are automatically enhanced with "documentation" context and optional version information to target library-specific results. Code Quality✅ Follows existing patterns: Implementation is nearly identical to Minor Style NoteOne small style improvement opportunity exists: the client tool has a redundant Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Copilot
participant ClientTool as SearchLibraryDocsClientTool
participant API as /api/copilot/execute-copilot-server-tool
participant Router as Server Tool Router
participant ServerTool as searchLibraryDocsServerTool
participant Exa as Exa API
participant Serper as Serper API
User->>Copilot: Request library documentation
Copilot->>ClientTool: execute({ library_name, query, version? })
ClientTool->>ClientTool: setState(executing)
ClientTool->>API: POST with toolName & payload
API->>Router: routeExecution('search_library_docs', params)
Router->>ServerTool: execute(params)
ServerTool->>ServerTool: Validate library_name & query
ServerTool->>ServerTool: Build search query with library + version
alt Has EXA_API_KEY
ServerTool->>Exa: executeTool('exa_search', { query, numResults: 10 })
alt Exa succeeds with results
Exa-->>ServerTool: Return search results
ServerTool-->>Router: Transform & return results
else Exa fails or no results
Exa-->>ServerTool: Error or empty results
Note over ServerTool: Fall back to Serper
end
end
alt No Exa key OR Exa failed
alt Has SERPER_API_KEY
ServerTool->>Serper: executeTool('serper_search', { query, num: 10 })
Serper-->>ServerTool: Return search results
ServerTool-->>Router: Transform & return results
else No Serper key
ServerTool-->>Router: Error: No API keys available
end
end
Router-->>API: Return results
API-->>ClientTool: HTTP 200 with results
ClientTool->>ClientTool: setState(success)
ClientTool->>ClientTool: markToolComplete(200, message, data)
ClientTool-->>Copilot: Tool complete
Copilot-->>User: Display library documentation results
|
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.
1 file reviewed, 1 comment
| this.setState(ClientToolCallState.success) | ||
| await this.markToolComplete( | ||
| 200, | ||
| `Library documentation search complete for ${args?.library_name || 'unknown'}`, | ||
| parsed.result | ||
| ) | ||
| this.setState(ClientToolCallState.success) |
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.
The state is set to ClientToolCallState.success twice (lines 70 and 76). While this follows the existing pattern in other similar tools like SearchOnlineClientTool and SearchDocumentationClientTool, this redundancy could be removed for cleaner code.
| this.setState(ClientToolCallState.success) | |
| await this.markToolComplete( | |
| 200, | |
| `Library documentation search complete for ${args?.library_name || 'unknown'}`, | |
| parsed.result | |
| ) | |
| this.setState(ClientToolCallState.success) | |
| const json = await res.json() | |
| const parsed = ExecuteResponseSuccessSchema.parse(json) | |
| await this.markToolComplete( | |
| 200, | |
| `Library documentation search complete for ${args?.library_name || 'unknown'}`, | |
| parsed.result | |
| ) | |
| this.setState(ClientToolCallState.success) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/lib/copilot/tools/client/other/search-library-docs.ts
Line: 70:76
Comment:
The state is set to `ClientToolCallState.success` twice (lines 70 and 76). While this follows the existing pattern in other similar tools like `SearchOnlineClientTool` and `SearchDocumentationClientTool`, this redundancy could be removed for cleaner code.
```suggestion
const json = await res.json()
const parsed = ExecuteResponseSuccessSchema.parse(json)
await this.markToolComplete(
200,
`Library documentation search complete for ${args?.library_name || 'unknown'}`,
parsed.result
)
this.setState(ClientToolCallState.success)
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Summary
Add context7 tool to copilot
Type of Change
Testing
Manual
Checklist