list_available_changelogs
Retrieve available changelog files from the Pydantic-AI documentation repository to track version history and updates.
Instructions
Lists all available changelog files found in the Pydantic-AI documentation repository (e.g., in 'docs/history/').
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the `list_available_changelogs` MCP tool, which scans the `docs/history/` directory for markdown files and returns them as a sorted list of `ChangelogFile` objects.
@app.tool() async def list_available_changelogs() -> List[ChangelogFile]: """ Lists all available changelog files found in the Pydantic-AI documentation repository (e.g., in 'docs/history/'). """ logger.info("list_available_changelogs called") changelogs: List[ChangelogFile] = [] try: repo_root = get_repo_path() history_dir = repo_root / "docs" / "history" if not history_dir.is_dir(): logger.warning(f"Changelog directory not found: {history_dir}") return [] for file_path in history_dir.glob("*.md"): if file_path.is_file(): version_name = file_path.stem relative_path = file_path.relative_to(history_dir).as_posix() changelogs.append( ChangelogFile( name=file_path.name, path=f"history/{relative_path}", version=version_name, ) ) changelogs.sort( key=lambda cf: [ int(part) if part.isdigit() else part for part in cf.version.split(".") ], reverse=True, ) logger.info(f"Found {len(changelogs)} changelog files.") except Exception as e: logger.error(f"Error listing available changelogs: {e}", exc_info=True) return [] return changelogs