-
Notifications
You must be signed in to change notification settings - Fork 625
Feature/mcp tool improve #635
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
WalkthroughThis change introduces support for selectively enabling MCP tools in conversations. It adds an Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (mcpToolsList.vue/NewThread.vue)
participant chatStore
participant mcpStore
participant ThreadPresenter
participant LLMProviderPresenter
participant McpPresenter
participant ToolManager
participant DB
User->>UI (mcpToolsList.vue): Enable/disable tool
UI->>chatStore: Update enabledMcpTools
UI->>mcpStore: Sync enabled tools if server status changes
User->>UI (NewThread.vue): Create new thread
UI->>chatStore: Read chatConfig (incl. enabledMcpTools)
UI->>ThreadPresenter: Create/generate thread (with enabledMcpTools)
ThreadPresenter->>LLMProviderPresenter: startStreamCompletion(..., enabledMcpTools)
LLMProviderPresenter->>McpPresenter: getAllToolDefinitions(enabledMcpTools)
McpPresenter->>ToolManager: getAllToolDefinitions(enabledMcpTools)
ToolManager-->>McpPresenter: Filtered tool definitions
McpPresenter-->>LLMProviderPresenter: Filtered tool definitions
LLMProviderPresenter-->>ThreadPresenter: Stream completion
ThreadPresenter-->>UI: Display response
ThreadPresenter->>DB: Store/retrieve enabledMcpTools in conversations
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 4
🧹 Nitpick comments (3)
src/main/presenter/mcpPresenter/toolManager.ts (1)
211-218: Consider extracting the filtering logic into a helper method.The filtering logic is duplicated between the cached and fresh data paths. This could lead to maintenance issues if the filtering logic needs to be updated.
Consider extracting the filtering logic into a private helper method:
private filterToolsByEnabled(tools: MCPToolDefinition[], enabledTools: string[]): MCPToolDefinition[] { const enabledSet = new Set(enabledTools) return tools.filter((toolDef) => { const finalName = toolDef.function.name const originalName = this.toolNameToTargetMap?.get(finalName)?.originalName || finalName return enabledSet.has(finalName) || enabledSet.has(originalName) }) }Then use it in both places:
- if (enabledTools && enabledTools.length > 0) { - const enabledSet = new Set(enabledTools) - return this.cachedToolDefinitions.filter((toolDef) => { - const finalName = toolDef.function.name - const originalName = this.toolNameToTargetMap?.get(finalName)?.originalName || finalName - return enabledSet.has(finalName) || enabledSet.has(originalName) - }) - } + if (enabledTools && enabledTools.length > 0) { + return this.filterToolsByEnabled(this.cachedToolDefinitions, enabledTools) + }src/renderer/src/components/mcpToolsList.vue (1)
35-47: Helper functions are well-implemented.The tool count functions correctly filter based on enabled tools with proper null safety.
The
getTotalEnabledToolCountfunction could be slightly more concise:const getTotalEnabledToolCount = () => { const enabledMcpTools = chatStore.chatConfig.enabledMcpTools || [] - const filterList = mcpStore.tools.filter((item) => enabledMcpTools.includes(item.function.name)) - return filterList.length + return mcpStore.tools.filter((item) => enabledMcpTools.includes(item.function.name)).length }src/main/presenter/sqlitePresenter/tables/conversations.ts (1)
23-30: Change comment to English to comply with coding guidelines.The function implementation is solid with proper error handling and type safety. However, the comment should be in English per the coding guidelines for TypeScript files.
-// 解析 JSON 字段 +// Parse JSON field with fallback default value
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
src/main/presenter/llmProviderPresenter/index.ts(3 hunks)src/main/presenter/mcpPresenter/index.ts(1 hunks)src/main/presenter/mcpPresenter/toolManager.ts(2 hunks)src/main/presenter/sqlitePresenter/tables/conversations.ts(9 hunks)src/main/presenter/threadPresenter/index.ts(7 hunks)src/renderer/src/components/NewThread.vue(1 hunks)src/renderer/src/components/mcpToolsList.vue(4 hunks)src/renderer/src/stores/chat.ts(1 hunks)src/renderer/src/stores/mcp.ts(4 hunks)src/shared/presenter.d.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (21)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Use English for logs and comments
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/shared/presenter.d.tssrc/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vuesrc/main/presenter/sqlitePresenter/tables/conversations.ts
src/renderer/src/**/*.vue
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI componentsUse scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/components/mcpToolsList.vue
src/renderer/src/**/*.{ts,tsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.{ts,tsx,vue}: Use Pinia for frontend state management
Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
src/renderer/src/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
src/renderer/**/*.{vue,ts}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
Implement lazy loading for routes and components.
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.
Files:
src/renderer/src/components/NewThread.vuesrc/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.tssrc/renderer/src/components/mcpToolsList.vue
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Strict type checking enabled for TypeScript
**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别
Files:
src/renderer/src/stores/chat.tssrc/shared/presenter.d.tssrc/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/sqlitePresenter/tables/conversations.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development-setup.mdc)
**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写
Files:
src/renderer/src/stores/chat.tssrc/shared/presenter.d.tssrc/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/sqlitePresenter/tables/conversations.ts
src/{main,renderer}/**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)
src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging
Files:
src/renderer/src/stores/chat.tssrc/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/sqlitePresenter/tables/conversations.ts
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/pinia-best-practices.mdc)
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}: Use modules to organize related state and actions
Implement proper state persistence for maintaining data across sessions
Use getters for computed state properties
Utilize actions for side effects and asynchronous operations
Keep the store focused on global state, not component-specific data
Files:
src/renderer/src/stores/chat.tssrc/renderer/src/stores/mcp.ts
src/shared/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Shared types in src/shared/
Files:
src/shared/presenter.d.ts
src/shared/*.d.ts
📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)
The shared/*.d.ts files are used to define the types of objects exposed by the main process to the renderer process
Files:
src/shared/presenter.d.ts
src/shared/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
共享类型定义放在
shared目录
Files:
src/shared/presenter.d.ts
src/main/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Main to Renderer: Use EventBus to broadcast events via mainWindow.webContents.send()
Use Electron's built-in APIs for file system and native dialogs
Files:
src/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/main/presenter/sqlitePresenter/tables/conversations.ts
src/main/presenter/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
One presenter per functional domain
Files:
src/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/main/presenter/sqlitePresenter/tables/conversations.ts
src/main/**/*.{ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
主进程代码放在
src/main
Files:
src/main/presenter/threadPresenter/index.tssrc/main/presenter/mcpPresenter/toolManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/llmProviderPresenter/index.tssrc/main/presenter/sqlitePresenter/tables/conversations.ts
src/main/presenter/mcpPresenter/index.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Register new MCP tool in mcpPresenter/index.ts
Files:
src/main/presenter/mcpPresenter/index.ts
src/main/presenter/llmProviderPresenter/index.ts
📄 CodeRabbit Inference Engine (.cursor/rules/llm-agent-loop.mdc)
src/main/presenter/llmProviderPresenter/index.ts:src/main/presenter/llmProviderPresenter/index.tsshould manage the overall Agent loop, conversation history, tool execution viaMcpPresenter, and frontend communication viaeventBus.
The main Agent loop inllmProviderPresenter/index.tsshould handle multi-round LLM calls and tool usage, maintaining conversation state and controlling the loop withneedContinueConversationandtoolCallCount.
The main Agent loop should send standardizedSTREAM_EVENTS(RESPONSE,END,ERROR) to the frontend viaeventBus.
The main Agent loop should buffer text content, handle tool call events, format tool results for the next LLM call, and manage conversation continuation logic.
Files:
src/main/presenter/llmProviderPresenter/index.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using `convertToProviderTools`) and included in the API request.
src/renderer/src/components/NewThread.vue (6)
Learnt from: neoragex2002
PR: #550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both text and content properties in the handleMeetingInstruction function's sendMessage call, even though they are redundant, rather than removing the content property.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.788Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Leverage Vue's built-in reactivity system for efficient data handling
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/**/*.{vue} : Use composition API and declarative programming patterns; avoid options API.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
src/renderer/src/stores/chat.ts (6)
Learnt from: neoragex2002
PR: #550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both text and content properties in the handleMeetingInstruction function's sendMessage call, even though they are redundant, rather than removing the content property.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/stores/**/*.ts : Use Pinia for state management.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
src/shared/presenter.d.ts (13)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : src/main/presenter/llmProviderPresenter/index.ts should manage the overall Agent loop, conversation history, tool execution via McpPresenter, and frontend communication via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Implement coreStream method following standardized event interface in LLM provider files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The coreStream method in each Provider must perform a single streaming API request per conversation round and must not contain multi-round tool call loop logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as needed for provider-specific logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop in llmProviderPresenter/index.ts should handle multi-round LLM calls and tool usage, maintaining conversation state and controlling the loop with needContinueConversation and toolCallCount.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield tool call events (tool_call_start, tool_call_chunk, tool_call_end) in the standardized format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should buffer text content, handle tool call events, format tool results for the next LLM call, and manage conversation continuation logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield events asynchronously using the async generator pattern.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should aggregate and yield usage events as part of the standardized stream.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should send standardized STREAM_EVENTS (RESPONSE, END, ERROR) to the frontend via eventBus.
src/main/presenter/threadPresenter/index.ts (14)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : src/main/presenter/llmProviderPresenter/index.ts should manage the overall Agent loop, conversation history, tool execution via McpPresenter, and frontend communication via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop in llmProviderPresenter/index.ts should handle multi-round LLM calls and tool usage, maintaining conversation state and controlling the loop with needContinueConversation and toolCallCount.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should buffer text content, handle tool call events, format tool results for the next LLM call, and manage conversation continuation logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as needed for provider-specific logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The coreStream method in each Provider must perform a single streaming API request per conversation round and must not contain multi-round tool call loop logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield tool call events (tool_call_start, tool_call_chunk, tool_call_end) in the standardized format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Implement coreStream method following standardized event interface in LLM provider files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should send standardized STREAM_EVENTS (RESPONSE, END, ERROR) to the frontend via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : All provider implementations must parse provider-specific data chunks and yield standardized events for text, reasoning, tool calls, usage, errors, stop reasons, and image data.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider does not support native function calling, it must prepare messages using prompt wrapping (e.g., prepareFunctionCallPrompt) before making the API call.
src/main/presenter/mcpPresenter/toolManager.ts (5)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield tool call events (tool_call_start, tool_call_chunk, tool_call_end) in the standardized format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
src/main/presenter/mcpPresenter/index.ts (8)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : src/main/presenter/llmProviderPresenter/index.ts should manage the overall Agent loop, conversation history, tool execution via McpPresenter, and frontend communication via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield tool call events (tool_call_start, tool_call_chunk, tool_call_end) in the standardized format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as needed for provider-specific logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Centralize configuration in configPresenter/
src/main/presenter/llmProviderPresenter/index.ts (14)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : src/main/presenter/llmProviderPresenter/index.ts should manage the overall Agent loop, conversation history, tool execution via McpPresenter, and frontend communication via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Implement coreStream method following standardized event interface in LLM provider files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The coreStream method in each Provider must perform a single streaming API request per conversation round and must not contain multi-round tool call loop logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop in llmProviderPresenter/index.ts should handle multi-round LLM calls and tool usage, maintaining conversation state and controlling the loop with needContinueConversation and toolCallCount.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should buffer text content, handle tool call events, format tool results for the next LLM call, and manage conversation continuation logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield tool call events (tool_call_start, tool_call_chunk, tool_call_end) in the standardized format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations must use a coreStream method that yields standardized stream events to decouple the main loop from provider-specific details.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as needed for provider-specific logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should send standardized STREAM_EVENTS (RESPONSE, END, ERROR) to the frontend via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield events asynchronously using the async generator pattern.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
src/renderer/src/stores/mcp.ts (17)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/stores/**/*.ts : Use Pinia for state management.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: neoragex2002
PR: #550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both text and content properties in the handleMeetingInstruction function's sendMessage call, even though they are redundant, rather than removing the content property.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Use Pinia for frontend state management
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : src/main/presenter/llmProviderPresenter/index.ts should manage the overall Agent loop, conversation history, tool execution via McpPresenter, and frontend communication via eventBus.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep the store focused on global state, not component-specific data
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use modules to organize related state and actions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/{composables,utils}/**/*.ts : Use VueUse for common composables and utility functions.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.788Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Use the Composition API for better code organization and reusability
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Utilize Nuxt's auto-imports feature for components and composables.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/renderer/src/**/*.vue : Use Composition API with proper TypeScript typing for new UI components
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.344Z
Learning: Applies to src/renderer/src/**/* : Use the 'vue-i18n' framework for all internationalization in the renderer
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:45:54.217Z
Learning: Applies to src/renderer/src/composables/usePresenter.ts : The IPC in the renderer process is implemented in usePresenter.ts, allowing direct calls to the presenter-related interfaces exposed by the main process
src/renderer/src/components/mcpToolsList.vue (12)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/**/*.{vue} : Leverage ref, reactive, and computed for reactive state management.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.788Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Use the Composition API for better code organization and reusability
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use modules to organize related state and actions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/**/*.{ts,tsx,vue} : Use arrow functions for methods and computed properties.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep the store focused on global state, not component-specific data
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.467Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.289Z
Learning: Applies to src/renderer/stores/**/*.ts : Use Pinia for state management.
Learnt from: neoragex2002
PR: #550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both text and content properties in the handleMeetingInstruction function's sendMessage call, even though they are redundant, rather than removing the content property.
src/main/presenter/sqlitePresenter/tables/conversations.ts (4)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.768Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.865Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : src/main/presenter/llmProviderPresenter/index.ts should manage the overall Agent loop, conversation history, tool execution via McpPresenter, and frontend communication via eventBus.
🧬 Code Graph Analysis (2)
src/main/presenter/mcpPresenter/toolManager.ts (1)
src/shared/presenter.d.ts (1)
MCPToolDefinition(892-908)
src/main/presenter/mcpPresenter/index.ts (1)
src/shared/presenter.d.ts (1)
MCPToolDefinition(892-908)
🔇 Additional comments (28)
src/renderer/src/components/NewThread.vue (1)
369-370: LGTM! Correctly implements MCP tool filtering for new threads.The addition of
enabledMcpTools: chatStore.chatConfig.enabledMcpToolsproperly propagates the per-conversation MCP tool enablement setting when creating new threads, which aligns with the PR objective of adding session-based control for MCP tools.src/renderer/src/stores/chat.ts (1)
59-60: LGTM! Properly adds MCP tool state management.The addition of
enabledMcpTools: []to thechatConfigreactive state correctly implements the foundation for per-conversation MCP tool control. The empty array initialization provides a sensible default, and the placement within the existing configuration structure is appropriate.src/main/presenter/mcpPresenter/index.ts (1)
413-419: LGTM! Correctly implements MCP tool filtering in the presenter layer.The addition of the optional
enabledMcpTools?: string[]parameter togetAllToolDefinitionsproperly enables filtering of MCP tools based on the enabled tools list. The parameter is correctly forwarded to the underlyingtoolManager.getAllToolDefinitions()method, and the existing MCP enablement check is preserved.The optional parameter maintains backward compatibility while supporting the new per-conversation tool filtering feature.
src/main/presenter/mcpPresenter/toolManager.ts (1)
47-56: LGTM! Well-implemented filtering logic for enabled tools.The implementation correctly filters tool definitions based on the enabled tools list, handling both cached and fresh data paths consistently. The use of Set for efficient membership checks and consideration of both final and original tool names is appropriate for the conflict resolution logic.
src/shared/presenter.d.ts (2)
505-506: LGTM! Appropriate interface extension for MCP tool filtering.The addition of the optional
enabledMcpToolsparameter to thestartStreamCompletionmethod maintains backward compatibility while enabling the new functionality for selective MCP tool usage.
538-538: LGTM! Consistent type definition for conversation-level MCP tool settings.The addition of
enabledMcpToolsto the conversation settings type is well-designed, maintaining backward compatibility while enabling per-conversation MCP tool configuration.src/main/presenter/llmProviderPresenter/index.ts (3)
294-301: LGTM! Clean parameter addition.The optional
enabledMcpToolsparameter is correctly added to the method signature, maintaining backward compatibility.
374-384: Correct tool filtering implementation.The
enabledMcpToolsparameter is properly passed to filter available tools before streaming, ensuring only permitted tools are available for the conversation.
595-597: Consistent tool filtering during execution.Good implementation - using the same
enabledMcpToolsfilter when looking up tool definitions ensures consistency throughout the agent loop.src/renderer/src/stores/mcp.ts (2)
7-7: Proper store integration following Pinia patterns.The chat store import and instantiation correctly follows Pinia composition patterns.
Also applies to: 33-33
517-521: Good initialization logic for new conversations.The code correctly caches all available tool names when there's no active thread, providing sensible defaults for new conversations.
src/renderer/src/components/mcpToolsList.vue (4)
12-12: Correct store integration following Vue patterns.The chat store import and instantiation properly follows Vue Composition API patterns.
Also applies to: 17-17
54-66: Well-implemented tool toggle logic.The enable/disable handlers correctly manage the tool list with proper deduplication and null safety.
110-110: UI correctly reflects enabled tool counts.The interface updates consistently show enabled tool counts instead of total counts, providing accurate feedback to users.
Also applies to: 118-120, 180-180
186-202: Excellent implementation of per-tool controls.The individual tool switches are properly implemented with correct state binding and event handling. The empty state message provides good UX.
src/main/presenter/threadPresenter/index.ts (6)
1577-1577: LGTM: Proper settings extraction.The destructuring correctly extracts the
enabledMcpToolsproperty along with other conversation settings.
1644-1645: LGTM: Correct parameter passing.The
enabledMcpToolsparameter is correctly passed tostartStreamCompletionmethod.
1793-1793: LGTM: Proper settings extraction in prompt preparation.The
enabledMcpToolsproperty is correctly extracted from conversation settings for use in prompt preparation.
1805-1805: LGTM: Correct MCP tools filtering implementation.This correctly passes the
enabledMcpToolsparameter togetAllToolDefinitions, implementing the core feature of per-conversation MCP tool filtering.
3053-3053: LGTM: Consistent settings extraction in resume flow.The
enabledMcpToolsproperty is correctly extracted from conversation settings in the resume stream completion flow.
3106-3107: LGTM: Correct parameter passing in resume flow.The
enabledMcpToolsparameter is correctly passed tostartStreamCompletionmethod in the resume stream completion flow.src/main/presenter/sqlitePresenter/tables/conversations.ts (7)
20-21: LGTM! Well-designed type addition for MCP tool storage.The nullable string type is appropriate for storing JSON data in SQLite and provides backward compatibility for existing conversations.
79-84: LGTM! Proper database migration implementation.The migration correctly adds the new column with an appropriate default value and follows the established pattern.
89-89: LGTM! Version increment is correct.
107-111: LGTM! Proper implementation of MCP tools storage in create method.The changes correctly add the new field to the INSERT statement and handle JSON serialization with appropriate fallback values.
Also applies to: 127-129
150-152: LGTM! Proper retrieval and parsing of MCP tools data.The changes correctly retrieve the new field and use the safe JSON parsing helper with appropriate fallback handling.
Also applies to: 176-177
230-233: LGTM! Consistent update handling for MCP tools.The changes follow the established pattern for updating settings and properly handle JSON serialization.
277-278: LGTM! Consistent implementation in list method.The changes maintain consistency with the get method and properly handle JSON parsing for the new MCP tools field.
Also applies to: 302-303
| await _loadTools() | ||
| await _loadClients() | ||
| } |
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.
Consider using throttled methods instead of private implementations.
The code directly calls _loadTools() and _loadClients() instead of the throttled versions (loadTools() and loadClients()). This bypasses the throttling mechanism which could lead to performance issues if updateServerStatus is called frequently.
Apply this diff to use the throttled versions:
- await _loadTools()
- await _loadClients()
+ await loadTools()
+ await loadClients()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| await _loadTools() | |
| await _loadClients() | |
| } | |
| await loadTools() | |
| await loadClients() | |
| } |
🤖 Prompt for AI Agents
In src/renderer/src/stores/mcp.ts around lines 168 to 170, the code calls the
private methods _loadTools() and _loadClients() directly, bypassing the
throttled public methods loadTools() and loadClients(). To fix this, replace the
calls to _loadTools() and _loadClients() with calls to the throttled methods
loadTools() and loadClients() to ensure the throttling mechanism is respected
and prevent potential performance issues.
| const isRunning = serverStatuses.value[serverName] || false | ||
| const currentTools = chatStore.chatConfig.enabledMcpTools || [] | ||
| if (isRunning) { | ||
| const serverTools = tools.value | ||
| .filter((tool) => tool.server.name === serverName) | ||
| .map((tool) => tool.function.name) | ||
| const mergedTools = Array.from(new Set([...currentTools, ...serverTools])) | ||
| chatStore.updateChatConfig({ enabledMcpTools: mergedTools }) | ||
| } else { | ||
| const allServerToolNames = tools.value.map((tool) => tool.function.name) | ||
| const filteredTools = currentTools.filter((name) => allServerToolNames.includes(name)) | ||
| chatStore.updateChatConfig({ enabledMcpTools: filteredTools }) | ||
| } |
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.
🛠️ Refactor suggestion
Tool synchronization logic needs refinement.
The current implementation has potential issues:
- When a server is not running, the filter removes tools based on whether they exist in
allServerToolNames, but this includes tools from the non-running server, which might incorrectly preserve them. - The logic could be more efficient.
Consider this improved implementation:
// 根据服务器的状态,关闭或者开启该服务器的所有工具
const isRunning = serverStatuses.value[serverName] || false
const currentTools = chatStore.chatConfig.enabledMcpTools || []
if (isRunning) {
const serverTools = tools.value
.filter((tool) => tool.server.name === serverName)
.map((tool) => tool.function.name)
const mergedTools = Array.from(new Set([...currentTools, ...serverTools]))
chatStore.updateChatConfig({ enabledMcpTools: mergedTools })
} else {
- const allServerToolNames = tools.value.map((tool) => tool.function.name)
- const filteredTools = currentTools.filter((name) => allServerToolNames.includes(name))
+ // Remove tools that belong to this specific server
+ const serverToolNames = tools.value
+ .filter((tool) => tool.server.name === serverName)
+ .map((tool) => tool.function.name)
+ const filteredTools = currentTools.filter((name) => !serverToolNames.includes(name))
chatStore.updateChatConfig({ enabledMcpTools: filteredTools })
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const isRunning = serverStatuses.value[serverName] || false | |
| const currentTools = chatStore.chatConfig.enabledMcpTools || [] | |
| if (isRunning) { | |
| const serverTools = tools.value | |
| .filter((tool) => tool.server.name === serverName) | |
| .map((tool) => tool.function.name) | |
| const mergedTools = Array.from(new Set([...currentTools, ...serverTools])) | |
| chatStore.updateChatConfig({ enabledMcpTools: mergedTools }) | |
| } else { | |
| const allServerToolNames = tools.value.map((tool) => tool.function.name) | |
| const filteredTools = currentTools.filter((name) => allServerToolNames.includes(name)) | |
| chatStore.updateChatConfig({ enabledMcpTools: filteredTools }) | |
| } | |
| const isRunning = serverStatuses.value[serverName] || false | |
| const currentTools = chatStore.chatConfig.enabledMcpTools || [] | |
| if (isRunning) { | |
| const serverTools = tools.value | |
| .filter((tool) => tool.server.name === serverName) | |
| .map((tool) => tool.function.name) | |
| const mergedTools = Array.from(new Set([...currentTools, ...serverTools])) | |
| chatStore.updateChatConfig({ enabledMcpTools: mergedTools }) | |
| } else { | |
| // Remove tools that belong to this specific server | |
| const serverToolNames = tools.value | |
| .filter((tool) => tool.server.name === serverName) | |
| .map((tool) => tool.function.name) | |
| const filteredTools = currentTools.filter((name) => !serverToolNames.includes(name)) | |
| chatStore.updateChatConfig({ enabledMcpTools: filteredTools }) | |
| } |
🤖 Prompt for AI Agents
In src/renderer/src/stores/mcp.ts around lines 172 to 184, the current tool
synchronization logic incorrectly preserves tools from non-running servers when
filtering and can be optimized. To fix this, update the filtering condition to
exclude tools belonging specifically to the non-running server instead of all
servers, ensuring only tools from running servers remain enabled. Refactor the
code to clearly separate tools by server status and merge or filter accordingly
for better accuracy and efficiency.
|
本身设计和代码逻辑没什么问题,我看到也有对于服务本身已经被移除和数据库中不一致的情况下的处理逻辑,pr我先合并了,但是可以建议对这部分补充一些 vitest 测试用例来自动化验证和测试(因为涉及到数据库migration,相对慎重一点) |
Pull Request Description
Is your feature request related to a problem? Please describe.
Support for switching control of MCP tools by session has been added. Previously, the MCP tool was globally enabled, and certain mcp tools could not be selected separately among multiple conversations.
Describe the solution you'd like
Introduced an enabledMcpTools field to the conversation database table. MCP tools are now filtered based on this field, ensuring each conversation only shows its allowed tools.
UI/UX changes for Desktop Application

Platform Compatibility Notes
It was only tested on Windows and no issues were found.
Pull Request Description (中文)
你的功能请求是否与某个问题有关?请描述一下。
新增了对 MCP 工具按会话进行切换控制的支持。之前 MCP 工具是全局启用的,多个对话不能单独选用某些mcp工具。
请描述你希望的解决方案
为 conversation 数据库表添加了 enabledMcpTools 字段。MCP 工具将根据该字段筛选,仅展示当前会话允许使用的工具。
桌面应用程序的 UI/UX 更改

平台兼容性注意事项
仅在 Windows 上测试,未发现问题。
Summary by CodeRabbit
New Features
Bug Fixes
Chores