get_frd
Retrieve Functional Requirements Document content by ID to enable AI-assisted generation of NestJS boilerplate architectures with core CRUD, database integration, authentication, and testing.
Instructions
Returns the content of an FRD by id. 00 -> FRD-00-master-orchestration.md 01 -> FRD-01-boilerplate-core-products.md ...
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frd_id | Yes |
Implementation Reference
- main.py:82-96 (handler)Main handler function for the 'get_frd' tool. Takes an frd_id parameter (limited to '00'-'04' via Literal type), validates it against FRD_MAPPING, and returns the content of the corresponding FRD file by calling _read_frd_file helper. Decorated with @mcp.tool() to register it as an MCP tool.
def get_frd( frd_id: Literal["00", "01", "02", "03", "04"] ) -> str: """ Returns the content of an FRD by id. 00 -> FRD-00-master-orchestration.md 01 -> FRD-01-boilerplate-core-products.md ... """ logger = _setup_logging() logger.info("Tool get_frd requested with frd_id=%s", frd_id) if frd_id not in FRD_MAPPING: raise ValueError(f"Invalid FRD id: {frd_id}") filename = FRD_MAPPING[frd_id] return _read_frd_file(filename) - main.py:83-84 (schema)Input schema/validation for get_frd tool. Uses Python's Literal type hint to restrict frd_id parameter to only allow values '00', '01', '02', '03', or '04'. Return type is defined as str.
frd_id: Literal["00", "01", "02", "03", "04"] ) -> str: - main.py:81-81 (registration)Tool registration via @mcp.tool() decorator. This registers the get_frd function as an available MCP tool with the FastMCP server instance.
@mcp.tool() - main.py:55-79 (helper)Helper function _read_frd_file that reads FRD markdown files from disk. Handles file I/O, logging, and error cases (FileNotFoundError and other exceptions). Called by get_frd to retrieve FRD content.
def _read_frd_file(filename: str) -> str: """ Reads an FRD from disk and returns it as string. Also writes logs to track which file was read, from which path and if there were any errors. """ logger = _setup_logging() path = FRD_DIR / filename logger.info(f"Reading FRD from disk: {path}") try: content = path.read_text(encoding="utf-8") logger.debug( "FRD read successfully: %s (%d characters)", path.name, len(content), ) return content except FileNotFoundError: logger.error("FRD not found: %s", path) raise except Exception as exc: logger.exception("Error reading FRD %s: %s", path, exc) raise - main.py:21-27 (helper)FRD_MAPPING dictionary that maps FRD IDs to their corresponding markdown filenames. Used by get_frd to translate frd_id parameter into actual file paths.
FRD_MAPPING: Dict[str, str] = { "00": "FRD-00-master-orchestration.md", "01": "FRD-01-boilerplate-core-products.md", "02": "FRD-02-products-database.md", "03": "FRD-03-auth-security.md", "04": "FRD-04-unit-testing.md", }