save_project_config
Store project configuration in .vscode-mcp.toml to apply workspace-specific settings for tool execution.
Instructions
Save project-specific configuration to .vscode-mcp.toml
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | Yes | Project configuration object | |
| path | No | Path to workspace directory (defaults to current) |
Implementation Reference
- The core handler function 'saveProjectConfig' that saves project configuration to .vscode-mcp.toml. It serializes the config using TOML, writes it to disk, updates the cache, and returns a ToolResult.
async saveProjectConfig(config: ProjectConfig, workspacePath?: string): Promise<ToolResult> { try { const resolvedPath = workspacePath || this.workspaceService.workspacePath; const configPath = path.join(resolvedPath, ProjectConfigService.CONFIG_FILENAME); const tomlContent = toml.stringify(config as any); await fs.writeFile(configPath, tomlContent, 'utf-8'); // Update cache this.configCache.set(configPath, config); return { content: [{ type: 'text', text: `Project configuration saved to ${configPath}` }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: `Failed to save project configuration: ${error}` }] }; } } - src/toolDefinitions.ts:642-653 (schema)The tool definition/input schema for 'save_project_config', declaring the required 'config' (object) and optional 'path' (string) input parameters.
{ name: 'save_project_config', description: 'Save project-specific configuration to .vscode-mcp.toml', inputSchema: { type: 'object', properties: { config: { type: 'object', description: 'Project configuration object' }, path: { type: 'string', description: 'Path to workspace directory (defaults to current)' } }, required: ['config'] } }, - src/index.ts:258-259 (registration)The tool handler registration in the switch statement of executeToolCommand, routing 'save_project_config' to projectConfigService.saveProjectConfig(args.config, args.path).
case 'save_project_config': return await this.projectConfigService.saveProjectConfig(args.config, args.path); - src/index.ts:99-99 (helper)Initialization of the ProjectConfigService instance used to handle the save_project_config tool.
this.projectConfigService = new ProjectConfigService(this.workspaceService); - Internal usage of saveProjectConfig as a helper when adding a command to the allowed commands list in SecureCommandService.
await this.configService.saveProjectConfig(config);