set_profile
Activate a specific profile in the MCP File Context Server to define context generation settings for code analysis and processing.
Instructions
Set the active profile for context generation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| profile_name | Yes | Name of the profile to activate |
Implementation Reference
- src/index.ts:1014-1042 (handler)MCP tool handler for 'set_profile' that extracts profile_name, calls ProfileService.setProfile, logs, and returns JSON response or error.private async handleSetProfile(args: any) { const { profile_name } = args; await this.loggingService.info('Setting profile', { profileName: profile_name, operation: 'set_profile' }); try { await this.profileService.setProfile(profile_name); const response = { message: `Successfully switched to profile: ${profile_name}`, timestamp: Date.now() }; await this.loggingService.info('Profile set successfully', { profileName: profile_name, operation: 'set_profile', response }); return this.createJsonResponse(response); } catch (error) { await this.loggingService.error('Failed to set profile', error as Error, { profileName: profile_name, operation: 'set_profile' }); throw new McpError( ErrorCode.InvalidParams, `Failed to set profile: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:375-387 (schema)Input schema and description for the set_profile tool defined in MCP server capabilities.set_profile: { description: 'Set the active profile for context generation. Available profiles: code (default), code-prompt (includes LLM instructions), code-file (saves to file)', inputSchema: { type: 'object', properties: { profile_name: { type: 'string', description: 'Name of the profile to activate' } }, required: ['profile_name'] } },
- src/index.ts:1613-1615 (registration)Registration of the set_profile handler in the CallToolRequestSchema switch statement.case 'set_profile': return await this.handleSetProfile(request.params.arguments); case 'get_profile_context':
- Supporting method in ProfileService that performs the actual profile switching logic, updates state, and persists it.public async setProfile(profileName: string): Promise<void> { await this.logger?.info('Attempting to set profile', { profileName, availableProfiles: Object.keys(this.config.profiles), operation: 'set_profile' }); if (!this.config.profiles[profileName]) { throw new Error(`Profile '${profileName}' does not exist. Available profiles: ${Object.keys(this.config.profiles).join(', ')}`); } this.state = { ...this.state, profile_name: profileName, timestamp: Date.now() }; await this.saveState(); await this.logger?.info('Successfully set profile', { profileName, operation: 'set_profile' }); }