docs.autodoc

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Autodoc — generate API reference from frozen app state.

Introspects the frozenRouter and ToolRegistryto produce DocPageinstances that live alongside hand-written markdown in the sameDocsCollection. All introspection is…

Autodoc — generate API reference from frozen app state.

Introspects the frozenRouter and ToolRegistryto produce DocPageinstances that live alongside hand-written markdown in the sameDocsCollection. All introspection is read-only.

Usage (internal — called byDocsPluginafter freeze)::

from chirp.docs.autodoc import generate_autodoc
pages = generate_autodoc(app)

docs.autodoc

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

function generate_autodoc

Generate API reference pages from frozen app state.

Must be called afterapp.freeze(). Returns DocPageinstances withsource=DocSource.AUTODOC.

Jump to symbol
function introspect_routes

ExtractRouteDocfrom each registered route.

Jump to symbol
function _extract_route_params

Extract path parameters from route path and handler signature.

Jump to symbol
function introspect_tools

ExtractToolDocfrom MCP tool info list.

Jump to symbol
function _flatten_schema

Flatten JSON Schema properties intoParamDoctuples.

Jump to symbol
function _slug_for_route

Generate a URL-safe slug from a route path.

/contacts/\{id}api/routes/contacts-id

Jump to symbol
function _slug_for_tool

Generate a URL-safe slug from a tool name.

search_docsapi/tools/search-docs

Jump to symbol
function _route_doc_to_markdown

Render a RouteDoc as markdown (for agent consumption via raw field).

Jump to symbol
function _tool_doc_to_markdown

Render a ToolDoc as markdown (for agent consumption via raw field).

Jump to symbol
function _markdown_to_html

Simple markdown-to-HTML for autodoc pages.

Uses MarkdownRenderer if available, falls back to minimal rendering.

Jump to symbol
function _route_doc_to_page

Convert a RouteDoc to a DocPage.

Jump to symbol
function _tool_doc_to_page

Convert a ToolDoc to a DocPage.

Jump to symbol
generate_autodoc
function
def generate_autodoc(app: App) -> tuple[DocPage, ...]

Generate API reference pages from frozen app state.

Must be called afterapp.freeze(). Returns DocPageinstances withsource=DocSource.AUTODOC.

Parameters

Name Type Default Description
app App
introspect_routes
function
def introspect_routes(routes: list[Route]) -> tuple[RouteDoc, ...]

ExtractRouteDocfrom each registered route.

Parameters

Name Type Default Description
routes list[Route]
_extract_route_params
function
def _extract_route_params(path: str, handler: Any) -> tuple[ParamDoc, ...]

Extract path parameters from route path and handler signature.

Parameters

Name Type Default Description
path str
handler Any
introspect_tools
function
def introspect_tools(tool_infos: list[McpToolInfo]) -> tuple[ToolDoc, ...]

ExtractToolDocfrom MCP tool info list.

Parameters

Name Type Default Description
tool_infos list[McpToolInfo]
_flatten_schema
function
def _flatten_schema(schema: dict[str, Any]) -> tuple[ParamDoc, ...]

Flatten JSON Schema properties intoParamDoctuples.

Parameters

Name Type Default Description
schema dict[str, Any]
_slug_for_route
function
def _slug_for_route(path: str) -> str

Generate a URL-safe slug from a route path.

/contacts/\{id}api/routes/contacts-id

Parameters

Name Type Default Description
path str
_slug_for_tool
function
def _slug_for_tool(name: str) -> str

Generate a URL-safe slug from a tool name.

search_docsapi/tools/search-docs

Parameters

Name Type Default Description
name str
_route_doc_to_markdown
function
def _route_doc_to_markdown(rd: RouteDoc) -> str

Render a RouteDoc as markdown (for agent consumption via raw field).

Parameters

Name Type Default Description
rd RouteDoc
_tool_doc_to_markdown
function
def _tool_doc_to_markdown(td: ToolDoc) -> str

Render a ToolDoc as markdown (for agent consumption via raw field).

Parameters

Name Type Default Description
td ToolDoc
_markdown_to_html
function
def _markdown_to_html(md: str) -> Markup

Simple markdown-to-HTML for autodoc pages.

Uses MarkdownRenderer if available, falls back to minimal rendering.

Parameters

Name Type Default Description
md str
_route_doc_to_page
function
def _route_doc_to_page(rd: RouteDoc, *, order: int) -> DocPage

Convert a RouteDoc to a DocPage.

Parameters

Name Type Default Description
rd RouteDoc
order int
_tool_doc_to_page
function
def _tool_doc_to_page(td: ToolDoc, *, order: int) -> DocPage

Convert a ToolDoc to a DocPage.

Parameters

Name Type Default Description
td ToolDoc
order int

View source · /home/runner/work/chirp/chirp/site/../src/chirp/docs/autodoc.py:1