Skip to main content
Glama
FosterG4

Code Reference Optimizer MCP Server

by FosterG4

update_config

Modify and apply configuration settings to optimize code context extraction, import analysis, and token usage for AI-assisted programming in TypeScript, JavaScript, Python, Go, and Rust.

Instructions

Update configuration settings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configYesConfiguration updates to apply

Implementation Reference

  • src/index.ts:198-211 (registration)
    Registration of the 'update_config' tool in the MCP server's listTools handler, including name, description, and input schema.
    { name: 'update_config', description: 'Update configuration settings with new values. Allows fine-tuning of the optimizer behavior including cache policies, token limits, analysis depth, performance thresholds, and feature toggles. Changes are applied immediately and persist for the current session.', inputSchema: { type: 'object', properties: { config: { type: 'object', description: 'Partial configuration object with updates to apply. Can include any combination of configuration sections. Changes are merged with existing settings, not replaced entirely.', }, }, required: ['config'], }, },
  • Main handler function for the 'update_config' tool. Extracts config from arguments, calls ConfigManager.updateConfig, optionally updates logger, and returns success response.
    private async handleUpdateConfig(args: any) { const { config } = args; if (!config) { throw new McpError(ErrorCode.InvalidParams, 'config is required'); } try { this.configManager.updateConfig(config); // Refresh logger configuration when logging section changes if (config.logging) { const logCfg = this.configManager.getConfig().logging; this.logger.updateConfig({ level: logCfg.level, toFile: logCfg.enableFileLogging, filePath: logCfg.logPath }); } return { content: [{ type: 'text', text: 'Configuration updated successfully', }], }; } catch (error) { this.logger.error(`update_config failed: ${error instanceof Error ? error.message : String(error)}`); throw new McpError(ErrorCode.InternalError, `Failed to update configuration: ${error instanceof Error ? error.message : String(error)}`); } }
  • TypeScript interface defining the full structure of CodeReferenceOptimizerConfig, used for config validation and updates in the tool.
    export interface CodeReferenceOptimizerConfig { // Cache settings cache: { maxSize: number; ttlMs: number; evictionPolicy: CacheEvictionPolicy; enablePersistence: boolean; persistencePath?: string; }; // Context extraction settings extraction: { strategy: ContextExtractionStrategy; maxTokens: number; includeComments: boolean; includeImports: boolean; includeExports: boolean; contextLines: number; minRelevanceScore: number; }; // Import optimization settings imports: { enableOptimization: boolean; preserveSideEffects: boolean; analyzeTransitiveDeps: boolean; maxDepthLevel: number; excludePatterns: string[]; includePatterns: string[]; }; // Diff settings diff: { enableContextualDiff: boolean; contextLines: number; ignoreWhitespace: boolean; ignoreComments: boolean; enableSymbolTracking: boolean; }; // Performance settings performance: { maxFileSize: number; maxConcurrentOperations: number; enableMetrics: boolean; timeoutMs: number; }; // Language-specific settings languages: { [language: string]: { enabled: boolean; extensions: string[]; parserOptions?: any; customRules?: OptimizationConfig; }; }; // Logging settings logging: { level: LogLevel; enableFileLogging: boolean; logPath?: string; enableMetricsLogging: boolean; }; // Security settings security: { allowedPaths: string[]; blockedPaths: string[]; maxFileAccess: number; enableSandbox: boolean; }; }
  • ConfigManager.updateConfig method: merges partial updates with current config, validates the new config, and notifies change listeners.
    updateConfig(updates: Partial<CodeReferenceOptimizerConfig>): void { this.config = this.mergeConfigs(this.config, updates); this.validateConfig(); this.notifyConfigChange(); }
  • Logger.updateConfig method: updates logger settings like level, file output, and path, called when logging config changes.
    updateConfig(config: LoggerConfig) { if (config.level) this.level = config.level; if (typeof config.toFile === 'boolean') this.toFile = config.toFile; if (config.filePath !== undefined) this.filePath = config.filePath; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FosterG4/mcpsaver'

If you have feedback or need assistance with the MCP directory API, please join our Discord server