Skip to main content
Glama

create_traceability_matrix

Generate a traceability matrix linking business requirements to features, use cases, and tasks with bidirectional tracking for project management.

Instructions

Create a comprehensive requirements traceability matrix linking PRD business requirements → features → use cases → tasks with full bidirectional traceability

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes
prdContentYes
featuresYes
tasksYes
includeUseCasesYes
includeTraceabilityLinksYes
includeCoverageAnalysisYes
validateCompletenessYes

Implementation Reference

  • Core handler function that executes the create_traceability_matrix tool logic, processing inputs to generate a traceability matrix using RequirementsTraceabilityService.
    async function executeCreateTraceabilityMatrix(args: CreateTraceabilityMatrixArgs): Promise<MCPResponse> {
      const traceabilityService = new RequirementsTraceabilityService();
    
      try {
        // Create mock PRD from content
        const mockPRD = {
          id: `prd-${args.projectId}`,
          title: `PRD for ${args.projectId}`,
          overview: args.prdContent.substring(0, 500),
          objectives: extractObjectivesFromContent(args.prdContent),
          successMetrics: extractSuccessMetricsFromContent(args.prdContent),
          features: args.features,
          author: 'system',
          createdAt: new Date().toISOString(),
          updatedAt: new Date().toISOString(),
          aiGenerated: true,
          aiMetadata: {
            generatedBy: 'create-traceability-matrix',
            generatedAt: new Date().toISOString(),
            prompt: 'Extract PRD elements for traceability matrix',
            confidence: 0.8,
            version: '1.0.0'
          }
        };
    
        // Convert input tasks to AITask format
        const aiTasks = args.tasks.map(task => ({
          ...task,
          priority: task.priority as TaskPriority,
          complexity: task.complexity as TaskComplexity,
          status: TaskStatus.PENDING,
          dependencies: [],
          acceptanceCriteria: [],
          tags: [],
          aiGenerated: true,
          subtasks: [],
          createdAt: new Date().toISOString(),
          updatedAt: new Date().toISOString()
        }));
    
        // Create comprehensive traceability matrix
        const traceabilityMatrix = traceabilityService.createTraceabilityMatrix(
          args.projectId,
          mockPRD as any,
          args.features as any,
          aiTasks
        );
    
        // Validate completeness if requested
        let validation;
        if (args.validateCompleteness) {
          validation = validateTraceabilityCompleteness(traceabilityMatrix);
        }
    
        // Format response
        const summary = formatTraceabilityMatrixSummary(traceabilityMatrix, validation, args);
    
        return ToolResultFormatter.formatSuccess('create_traceability_matrix', {
          summary,
          traceabilityMatrix,
          validation,
          coverage: traceabilityMatrix.coverage,
          totalRequirements: traceabilityMatrix.businessRequirements.length,
          totalFeatures: traceabilityMatrix.features.length,
          totalUseCases: traceabilityMatrix.useCases.length,
          totalTasks: traceabilityMatrix.tasks.length
        });
    
      } catch (error) {
        process.stderr.write(`Error in create_traceability_matrix tool: ${error}\n`);
        return ToolResultFormatter.formatSuccess('create_traceability_matrix', {
          error: `Failed to create traceability matrix: ${error instanceof Error ? error.message : 'Unknown error'}`,
          success: false
        });
      }
    }
  • Zod schema defining the input parameters and validation for the create_traceability_matrix tool.
    const createTraceabilityMatrixSchema = z.object({
      projectId: z.string().describe('ID of the project to create traceability matrix for'),
      prdContent: z.string().min(100).describe('PRD content to extract business requirements from'),
      features: z.array(z.object({
        id: z.string(),
        title: z.string(),
        description: z.string(),
        priority: z.enum(['critical', 'high', 'medium', 'low']),
        userStories: z.array(z.string()),
        acceptanceCriteria: z.array(z.string()),
        estimatedComplexity: z.number().min(1).max(10)
      })).describe('List of features to include in traceability'),
      tasks: z.array(z.object({
        id: z.string(),
        title: z.string(),
        description: z.string(),
        complexity: z.number().min(1).max(10),
        estimatedHours: z.number(),
        priority: z.enum(['critical', 'high', 'medium', 'low'])
      })).describe('List of tasks to include in traceability'),
      includeUseCases: z.boolean().default(true).describe('Whether to generate use cases from features'),
      includeTraceabilityLinks: z.boolean().default(true).describe('Whether to generate traceability links'),
      includeCoverageAnalysis: z.boolean().default(true).describe('Whether to include coverage analysis'),
      validateCompleteness: z.boolean().default(true).describe('Whether to validate traceability completeness')
    });
  • Registration of the createTraceabilityMatrixTool in the central ToolRegistry during initialization.
    this.registerTool(addFeatureTool);
    this.registerTool(generatePRDTool);
    this.registerTool(parsePRDTool);
    this.registerTool(getNextTaskTool);
    this.registerTool(analyzeTaskComplexityTool);
    this.registerTool(expandTaskTool);
    this.registerTool(enhancePRDTool);
    this.registerTool(createTraceabilityMatrixTool);
  • src/index.ts:380-381 (registration)
    Dispatch handler in the main MCP server that routes call_tool requests for create_traceability_matrix to the execute function.
    case "create_traceability_matrix":
      return await executeCreateTraceabilityMatrix(args);
  • Helper function to validate the completeness of the generated traceability matrix, calculating coverage scores and identifying issues.
    function validateTraceabilityCompleteness(matrix: any): {
      isComplete: boolean;
      score: number;
      issues: string[];
      recommendations: string[];
    } {
      const issues = [];
      const recommendations = [];
      let score = 100;
    
      // Check coverage
      const coverage = matrix.coverage;
    
      if (coverage.orphanedTasks.length > 0) {
        issues.push(`${coverage.orphanedTasks.length} tasks have no requirements traceability`);
        score -= coverage.orphanedTasks.length * 5;
        recommendations.push('Link orphaned tasks to requirements or use cases');
      }
    
      if (coverage.unimplementedRequirements.length > 0) {
        issues.push(`${coverage.unimplementedRequirements.length} requirements have no implementing tasks`);
        score -= coverage.unimplementedRequirements.length * 10;
        recommendations.push('Create tasks to implement all requirements');
      }
    
      // Check use case coverage
      const useCaseCoverage = (coverage.useCasesCovered / matrix.useCases.length) * 100;
      if (useCaseCoverage < 90) {
        issues.push(`Only ${useCaseCoverage.toFixed(1)}% of use cases have implementing tasks`);
        score -= (90 - useCaseCoverage) / 2;
        recommendations.push('Ensure all use cases have implementing tasks');
      }
    
      // Check feature coverage
      const featureCoverage = (coverage.featuresCovered / matrix.features.length) * 100;
      if (featureCoverage < 95) {
        issues.push(`Only ${featureCoverage.toFixed(1)}% of features have use cases`);
        score -= (95 - featureCoverage) / 2;
        recommendations.push('Create use cases for all features');
      }
    
      score = Math.max(0, Math.min(100, score));
    
      return {
        isComplete: score >= 90 && issues.length === 0,
        score: Math.round(score),
        issues,
        recommendations
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Create' implies a write/mutation operation, the description doesn't specify what gets created (file? database entry? visual artifact?), whether this operation is idempotent, what permissions are required, or what happens on failure. It mentions 'comprehensive' and 'full bidirectional traceability' but doesn't explain what those mean operationally.

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, well-structured sentence that efficiently communicates the core purpose. Every word earns its place - 'comprehensive' sets scope, the arrow notation clearly shows relationships, and 'full bidirectional traceability' specifies a key characteristic. There's no wasted verbiage or redundancy.

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?

For a complex tool with 8 parameters (all required), 0% schema description coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool produces (no output schema), doesn't clarify parameter purposes, and provides minimal behavioral context. While the purpose is clear, the description leaves too many operational questions unanswered for effective agent use.

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

Parameters2/5

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

With 0% schema description coverage for all 8 parameters, the description provides no information about what any parameter means or how they should be used. The description mentions 'PRD business requirements', 'features', 'use cases', and 'tasks' which loosely map to some parameters, but doesn't explain the purpose of 'includeUseCases', 'includeTraceabilityLinks', 'includeCoverageAnalysis', or 'validateCompleteness' parameters. The description fails to compensate for the complete lack of schema documentation.

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

Purpose5/5

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

The description clearly states the specific action ('Create a comprehensive requirements traceability matrix') and specifies the exact relationships being established ('linking PRD business requirements → features → use cases → tasks with full bidirectional traceability'). It distinguishes itself from sibling tools like 'create_project' or 'create_roadmap' by focusing specifically on traceability matrix creation rather than general project management artifacts.

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. It doesn't mention prerequisites (e.g., needing existing project data), doesn't specify when this tool is appropriate versus other creation tools like 'create_project' or 'create_roadmap', and offers no exclusions or limitations. The agent must infer usage context from the tool name and parameters 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/HarshKumarSharma/MCP'

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