Skip to main content
Glama

set_file_approval

Mark files as approved for development, code review, or QA stages to manage workflow permissions and track changes in coding sessions.

Instructions

Set approval status for a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the file
approvalTypeYes
approvedByYesWho approved it

Implementation Reference

  • Executes the 'set_file_approval' tool by parsing input arguments and delegating to the MemoryManager's setFileApproval method.
    case 'set_file_approval': {
      const filePath = args.filePath as string;
      const approvalType = args.approvalType as keyof import('./types').ApprovalStatus;
      const approvedBy = args.approvedBy as string;
      await this.memoryManager.setFileApproval(filePath, approvalType, approvedBy);
      return { content: [{ type: 'text', text: 'File approval set successfully' }] };
  • Input schema definition for the 'set_file_approval' tool, defining parameters and validation.
    inputSchema: {
      type: 'object',
      properties: {
        filePath: { type: 'string', description: 'Path to the file' },
        approvalType: { type: 'string', enum: ['devApproved', 'codeReviewApproved', 'qaApproved'] },
        approvedBy: { type: 'string', description: 'Who approved it' }
      },
      required: ['filePath', 'approvalType', 'approvedBy']
    }
  • src/index.ts:603-614 (registration)
    Registers the 'set_file_approval' tool with the MCP server, including name, description, and input schema.
      name: 'set_file_approval',
      description: 'Set approval status for a file',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: { type: 'string', description: 'Path to the file' },
          approvalType: { type: 'string', enum: ['devApproved', 'codeReviewApproved', 'qaApproved'] },
          approvedBy: { type: 'string', description: 'Who approved it' }
        },
        required: ['filePath', 'approvalType', 'approvedBy']
      }
    },
  • Core implementation that updates the approval status for a file in the project memory, handling different approval types via a switch statement.
    async setFileApproval(filePath: string, approvalType: keyof ApprovalStatus, approvedBy: string): Promise<void> {
      const memory = await this.getProjectMemory();
      const relativePath = path.relative(this.projectRoot, filePath);
      
      if (!memory.approvalStates[relativePath]) {
        memory.approvalStates[relativePath] = {};
      }
    
      const approvals = memory.approvalStates[relativePath];
      
      // Set the approval status
      switch (approvalType) {
        case 'devApproved':
          approvals.devApproved = true;
          approvals.devApprovedBy = approvedBy;
          approvals.devApprovedDate = new Date().toISOString();
          break;
        case 'codeReviewApproved':
          approvals.codeReviewApproved = true;
          approvals.codeReviewApprovedBy = approvedBy;
          approvals.codeReviewDate = new Date().toISOString();
          break;
        case 'qaApproved':
          approvals.qaApproved = true;
          approvals.qaApprovedBy = approvedBy;
          approvals.qaApprovedDate = new Date().toISOString();
          break;
      }
    
      await this.saveProjectMemory(memory);
      
      console.log(chalk.green(`✅ ${approvalType} set for ${relativePath} by ${approvedBy}`));
    }
  • TypeScript interface defining the structure of ApprovalStatus used for file approvals.
    export interface ApprovalStatus {
      devApproved?: boolean;
      devApprovedBy?: string;
      devApprovedDate?: string;
      codeReviewApproved?: boolean;
      codeReviewApprovedBy?: string;
      codeReviewDate?: string;
      qaApproved?: boolean;
      qaApprovedBy?: string;
      qaApprovedDate?: string;

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/keleshteri/mcp-memory'

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