get_changelog_content
Retrieve parsed changelog content from Pydantic-AI documentation to access version history and release details for specific files.
Instructions
Retrieves the parsed content of a specific changelog file. The path should be relative to the Pydantic-AI documentation root's 'docs' directory (e.g., 'history/0.1.0.md').
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- The handler implementation for the get_changelog_content tool, which reads a changelog file from the documentation repository.
@app.tool() async def get_changelog_content(path: str) -> Optional[ChangelogContent]: """ Retrieves the parsed content of a specific changelog file. The path should be relative to the Pydantic-AI documentation root's 'docs' directory (e.g., 'history/0.1.0.md'). """ logger.info(f"get_changelog_content called for path: {path}") try: repo_root = get_repo_path() docs_dir = repo_root / "docs" changelog_file_path = (docs_dir / path).resolve() if not str(changelog_file_path).startswith(str(docs_dir.resolve())): logger.warning( f"Path traversal attempt or invalid path for get_changelog_content: {path}" ) return None if not changelog_file_path.is_file(): logger.info( f"Changelog file not found or not a file at path: {path} (resolved: {changelog_file_path})" ) return None content = changelog_file_path.read_text(encoding="utf-8") version = Path(path).stem return ChangelogContent( path=path, version=version, content=content, release_date=None, ) except Exception as e: logger.error( f"Error in get_changelog_content for path '{path}': {e}", exc_info=True ) return None