ExamplescriptintermediateRunnableresearch-brief
Get Web Page
Runnable example (intermediate) for script using docling.
Key Facts
- Level
- intermediate
- Runtime
- Python • Docling
- Pattern
- Context-backed research with explicit evidence
- Interaction
- Live sandbox • Script
- Updated
- 14 March 2026
Navigate this example
Library
Browse examplesReopen the wider library to compare adjacent patterns and linked learning paths.Interaction
Run sandbox nowTry the interaction directly in this example’s guided sandbox surface.Source
Open full sourceRead the real implementation, highlighted checkpoints, and runtime requirements.MCP
Call via MCPUse the same resource inside agents, deterministic exports, and MCP setup flows.
Linked principles
get_web_page.py
python
from docling.document_converter import DocumentConverter
converter = DocumentConverter()
def get_web_page(url: str) -> str:
"""Fetch and convert a web page to markdown."""
page_content = converter.convert(url)
return page_content.document.export_to_markdown()
def get_tool_definition():
return {
"type": "function",
"name": "get_web_page",
"description": "Fetch and retrieve the content of a specific web page given its URL. Use this when you need to read a particular webpage.",
"parameters": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The URL of the web page to fetch",
},
},
"required": ["url"],
"additionalProperties": False,
},
"strict": True,
}
Related principles
- P4trustApply progressive disclosure to system agencyProvide the minimum information necessary by default, while enabling users to inspect additional detail when confidence, understanding, or intervention is required.Open principle →
- P6visibilityExpose meaningful operational state, not internal complexityPresent the state of the system in language and structures that are relevant to the user, rather than exposing low-level internals that do not support action or understanding.Open principle →
- P7trustEstablish trust through inspectabilityUsers should be able to examine how a result was produced when confidence, accountability, or decision quality is important.Open principle →
- P9orchestrationRepresent delegated work as a system, not merely as a conversationWhere work involves multiple steps, agents, dependencies, or concurrent activities, it should be represented as a structured system rather than solely as a message stream.Open principle →