get_index
Retrieve the raw YAML content of the NCCN guidelines index for accurate access to clinical cancer treatment information.
Instructions
Get the raw contents of the NCCN guidelines index YAML file.
Returns:
String containing the raw YAML content of the guidelines index
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:146-165 (handler)The handler function for the MCP tool 'get_index'. It reads and returns the raw YAML content of the NCCN guidelines index file created by the initialization process.@mcp.tool() async def get_index() -> str: """ Get the raw contents of the NCCN guidelines index YAML file. Returns: String containing the raw YAML content of the guidelines index """ try: index_path = current_dir / GUIDELINES_INDEX_FILE with open(index_path, 'r', encoding='utf-8') as f: content = f.read() logger.info(f"Successfully loaded guidelines index from {index_path}") return content except FileNotFoundError: logger.error(f"Guidelines index file not found: {index_path}") return "Error: Guidelines index file not found" except Exception as e: logger.error(f"Error reading guidelines index: {str(e)}") return f"Error reading guidelines index: {str(e)}"
- server.py:146-146 (registration)The @mcp.tool() decorator registers the get_index function as an MCP tool.@mcp.tool()
- server.py:81-84 (helper)During server initialization, ensure_nccn_index is called to create/update the guidelines index file that get_index reads.guidelines_data = await ensure_nccn_index( output_file=str(current_dir / GUIDELINES_INDEX_FILE), max_age_days=7 # Refresh index every 7 days )