Skip to main content
Glama

generate_remediation

Provides actionable remediation guidance for security findings to address vulnerabilities and ensure compliance with industry standards.

Instructions

Generate actionable remediation advice for findings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
findingIdsNoIDs of findings to generate remediation for

Implementation Reference

  • Tool registration including name, description, and input schema in the ListTools response.
    {
      name: 'generate_remediation',
      description: 'Generate actionable remediation advice for findings',
      inputSchema: {
        type: 'object',
        properties: {
          findingIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'IDs of findings to generate remediation for'
          },
        },
        required: [],
      },
    },
  • The main handler function for the 'generate_remediation' tool, which delegates to RemediationAdvisor.
    private async handleGenerateRemediation(_args: any): Promise<any> {
      // Get recent scan results or specific findings
      // For demo, we'll generate advice for sample findings
      const sampleFindings = [
        {
          id: 'sample_001',
          type: 'dependency',
          severity: 'high' as const,
          title: 'Vulnerable dependency: lodash@4.17.19',
          description: 'Known security vulnerability CVE-2021-23337',
          location: { file: 'package.json' },
          cve: 'CVE-2021-23337',
        },
      ];
    
      const plan = await this.remediationAdvisor.generateRemediationPlan(sampleFindings);
      const markdown = this.remediationAdvisor.generateMarkdownReport(plan);
    
      return {
        status: 'success',
        remediations: plan.remediations.length,
        summary: plan.summary,
        report: markdown,
      };
    }
  • Core implementation of remediation plan generation, called by the tool handler.
    async generateRemediationPlan(findings: Finding[]): Promise<RemediationPlan> {
      const remediations: RemediationAdvice[] = [];
      
      for (const finding of findings) {
        const advice = await this.generateRemediationAdvice(finding);
        remediations.push(advice);
      }
    
      // Categorize by priority
      const prioritizedActions = {
        immediate: remediations.filter(r => r.priority === 'immediate'),
        high: remediations.filter(r => r.priority === 'high'),
        medium: remediations.filter(r => r.priority === 'medium'),
        low: remediations.filter(r => r.priority === 'low'),
      };
    
      // Calculate summary
      const autoFixable = remediations.filter(r => r.effort === 'trivial').length;
      const immediateActions = prioritizedActions.immediate.length;
      const totalEffort = this.calculateTotalEffort(remediations);
    
      return {
        findings,
        remediations,
        summary: {
          totalFindings: findings.length,
          autoFixable,
          immediateActions,
          estimatedEffort: totalEffort,
        },
        prioritizedActions,
      };
    }
  • Type definition for the RemediationPlan output structure.
    export interface RemediationPlan {
      findings: Finding[];
      remediations: RemediationAdvice[];
      summary: {
        totalFindings: number;
        autoFixable: number;
        immediateActions: number;
        estimatedEffort: string;
      };
      prioritizedActions: {
        immediate: RemediationAdvice[];
        high: RemediationAdvice[];
        medium: RemediationAdvice[];
        low: RemediationAdvice[];
      };
    }
  • Helper function that generates detailed remediation advice for individual findings.
    private async generateRemediationAdvice(finding: Finding): Promise<RemediationAdvice> {
      // Determine remediation type based on finding
      const remediationType = this.determineRemediationType(finding);
      const baseRemediation = this.remediationDatabase.get(remediationType);
    
      // Determine priority based on severity
      const priority = this.determinePriority(finding);
    
      // Build customized advice
      const advice: RemediationAdvice = {
        findingId: finding.id,
        priority,
        effort: baseRemediation?.effort || this.estimateEffort(finding),
        automaticFix: baseRemediation?.automaticFix,
        manualSteps: baseRemediation?.manualSteps,
        codeExample: baseRemediation?.codeExample,
        references: baseRemediation?.references || this.getDefaultReferences(finding.type),
        estimatedTime: baseRemediation?.estimatedTime || this.estimateTime(finding),
        tools: baseRemediation?.tools,
        preventionTips: this.generatePreventionTips(finding),
      };
    
      // Customize advice based on specific finding details
      if (finding.type === 'dependency' && finding.cve) {
        advice.automaticFix = `Update to version that patches ${finding.cve}`;
        advice.references = [
          `https://nvd.nist.gov/vuln/detail/${finding.cve}`,
          ...advice.references || [],
        ];
      }
    
      if (finding.type === 'secret') {
        advice.priority = 'immediate'; // Secrets are always immediate priority
        advice.manualSteps = [
          `Immediately rotate the exposed ${this.identifySecretType(finding.title)}`,
          ...advice.manualSteps || [],
        ];
      }
    
      return advice;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool generates advice but doesn't cover critical aspects like whether this is a read-only operation, if it requires specific permissions, what the output format might be, or any rate limits. This is a significant gap for a tool that likely interacts with findings data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It is appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of generating remediation advice, the lack of annotations and output schema, and the presence of sibling tools, the description is incomplete. It doesn't explain the output format, behavioral traits, or how it differs from other tools, leaving the agent with insufficient context to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'findingIds' clearly documented in the schema. The description adds no additional meaning beyond what the schema provides, such as explaining what constitutes a valid ID or how the advice is generated. Given the high schema coverage, a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('generate') and the resource ('actionable remediation advice for findings'), making the purpose understandable. However, it doesn't differentiate this tool from sibling tools like 'manage_false_positives' or 'check_compliance', which might also involve findings remediation, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'manage_false_positives' or 'check_compliance'. It lacks explicit context, prerequisites, or exclusions, leaving the agent to infer usage based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/NeoTecDigital/mcp_shamash'

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