Skip to content

Commit 1845f1b

Browse files
feat: 支持通过环境变量配置工具模型
Co-authored-by: aider (vertex_ai/gemini-2.5-pro) <aider@aider.chat>
1 parent 11b8aa3 commit 1845f1b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/mcp-server/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ async function startMcpServer() {
134134
await config.refreshAuth(selectedAuthType);
135135
console.log(`Using authentication method: ${selectedAuthType}`);
136136

137+
// Check for the custom tools model environment variable
138+
const toolsDefaultModel = process.env.GEMINI_TOOLS_DEFAULT_MODEL;
139+
if (toolsDefaultModel && toolsDefaultModel.trim() !== '') {
140+
config.setModel(toolsDefaultModel.trim());
141+
console.log(`🚀 Using custom model for tools: ${toolsDefaultModel.trim()}`);
142+
} else {
143+
// Log the default model being used if the environment variable is not set
144+
console.log(`⚙️ Using default model for tools: ${config.getModel()}`);
145+
}
146+
137147
// 4. 初始化并启动 MCP 桥接服务 和 OpenAI 服务
138148
const mcpBridge = new GcliMcpBridge(config, cliVersion);
139149

0 commit comments

Comments
 (0)