Skip to main content
Glama
bsmi021

MCP File Context Server

by bsmi021

set_profile

Activate a specific profile to configure context generation settings for code analysis and file operations.

Instructions

Set the active profile for context generation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profile_nameYesName of the profile to activate

Implementation Reference

  • Schema definition for the set_profile tool 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']
        }
    },
  • MCP tool handler for set_profile that delegates to ProfileService.setProfile and handles errors/logging
    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'}`
            );
        }
    }
  • Core ProfileService method implementing set_profile logic: validates profile, updates state, saves to file
    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'
        });
    }
  • src/index.ts:1614-1615 (registration)
    Tool dispatcher registration mapping 'set_profile' to handleSetProfile in CallToolRequestSchema handler
        return await this.handleSetProfile(request.params.arguments);
    case 'get_profile_context':

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/bsmi021/mcp-file-context-server'

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