mirror of
https://github.com/unclecode/crawl4ai.git
synced 2026-06-12 00:38:00 +00:00
fix: Add docstring to MCP tool 'md' endpoint
Fixes #1652 The `get_markdown` function was missing a docstring, which caused the MCP tool 'md' to have no description when exposed via `_list_tools()`. This made it difficult for LLMs and developers to understand the tool's purpose. Added comprehensive docstring describing the tool's functionality and supported extraction modes. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -308,6 +308,17 @@ async def get_markdown(
|
||||
body: MarkdownRequest,
|
||||
_td: Dict = Depends(token_dep),
|
||||
):
|
||||
"""
|
||||
Convert a web page into Markdown format.
|
||||
|
||||
Supports multiple extraction modes:
|
||||
- fit (default): Readability-based extraction for clean content
|
||||
- raw: Direct DOM to Markdown conversion
|
||||
- bm25: BM25 relevance ranking with optional query
|
||||
- llm: LLM-based summarization with optional query
|
||||
|
||||
Use this tool when you need clean, readable text from web pages.
|
||||
"""
|
||||
if not body.url.startswith(("http://", "https://")) and not body.url.startswith(("raw:", "raw://")):
|
||||
raise HTTPException(
|
||||
400, "Invalid URL format. Must start with http://, https://, or for raw HTML (raw:, raw://)")
|
||||
|
||||
Reference in New Issue
Block a user