---
title: "Build Framework Rules"
method: POST
path: "/tools/v1/build"
---

# Build Framework Rules

`POST /tools/v1/build`

## Request

- Base URL: `https://api.qualityclouds.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.qualityclouds.ai/tools/v1/build`
- Auth: one of:
  - HTTP bearer
  - OpenID Connect (`https://account.qualityclouds.com//realms/ai-production/.well-known/openid-configuration`)

Build framework-specific rules using LLM.

This endpoint generates a JSON file with framework-specific rules by:
1. Validating that the target exists and is a Framework
2. Generating rules using LLM with a specialized prompt
3. Saving the rules to tools_api/data/{repository_id}/tool_builder/{target_key}/rules.json

Args:
    body: Request body with target_key, repository_id, and optional framework_version
    authenticated_user: Authenticated user making the request
    handler: Handler for processing the request
    credentials: Authorization credentials
    
Returns:
    BuildFrameworkRulesResponse: Response with status and rules file path
    
Raises:
    HTTPException 422: If target doesn't exist, is not a Framework, or validation fails
    HTTPException 400: For other errors during processing

## Request body

- BuildFrameworkRulesBody: HTTP body for building framework rules endpoint. Attributes: target_key: Framework target key (e.g., "laravel", "flask") repository_id: Repository identifier framework_version: Framework version (optional, defaults to "latest") num_rules_to_build: Number of rules to generate (optional, default 30) build_instructions: Optional user instructions for the prompt impact_areas_ids: Optional list of impact area IDs to constrain categories tool_name: Optional custom name to derive tool_id from (avoids unique key when creating multiple tools for the same target) ce_type_ids: Optional explicit ce_types (None = LLM chooses from catalog) agent_feature_ids: Optional explicit agent_features (None = LLM chooses) stack_profile_id: Optional curated profile to copy scope from (build v2)
  - `target_key` string, required
  - `repository_id` string, required
  - `framework_version` string, nullable
  - `num_rules_to_build` integer, nullable
  - `build_instructions` string, nullable
  - `impact_areas_ids` string[], nullable
  - `tool_name` string, nullable
  - `ce_type_ids` string[], nullable
  - `agent_feature_ids` string[], nullable
  - `stack_profile_id` string, uuid, nullable
  - `files_whitelist` string[], nullable: Restrict all generated rules to these glob path patterns. Examples: 'src/controllers/**/*.php', 'app/Http/**', '**/*Service.py'. Uses forward slashes and standard glob wildcards (* = single level, ** = recursive). Leave empty or null to let the LLM decide per rule.

## Response `200`

Successful Response

- BuildFrameworkRulesResponse: Response for building framework rules. Attributes: status: Status of the operation (always "success") message: Human-readable message describing the result rules_path: Path where the rules JSON file was saved tool_id: ID of the tool created in database
  - `status` 'success'
  - `message` string, required
  - `rules_path` string, required
  - `tool_id` string, required

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `422`: Validation Error

---

[API](https://skmtc.dev/qualityclouds/apis/qai-orchestrator-api.md) · [All operations](https://skmtc.dev/qualityclouds/apis/qai-orchestrator-api/llms.txt) · [OpenAPI document](https://skmtc.dev/qualityclouds/apis/qai-orchestrator-api/revisions/250c849925af?raw)
