@@ -232,6 +232,41 @@ def check_docs_for_union(
232232 return missing_docs , extra_docs
233233
234234
235+ def _strip_docstring_sections (description : str ) -> str :
236+ """Strip Args/Returns/Raises sections from a docstring, keeping only the summary.
237+
238+ Args:
239+ description: The full docstring
240+
241+ Returns:
242+ Just the summary/description part without parameter documentation
243+ """
244+ lines = description .split ("\n " )
245+ result = []
246+ in_section = False
247+
248+ for line in lines :
249+ stripped = line .strip ()
250+ # Check if we're entering a standard docstring section
251+ if stripped in ("Args:" , "Arguments:" , "Returns:" , "Raises:" , "Yields:" , "Note:" ):
252+ in_section = True
253+ continue
254+ # Check if we're in a section (indented content after section header)
255+ if in_section :
256+ # If line is empty or still indented, skip it
257+ if not stripped or line .startswith (" " ) or line .startswith ("\t " ):
258+ continue
259+ # Non-indented non-empty line means new content
260+ in_section = False
261+ result .append (line )
262+
263+ # Clean up trailing empty lines
264+ while result and not result [- 1 ].strip ():
265+ result .pop ()
266+
267+ return "\n " .join (result )
268+
269+
235270def tool_to_markdown (tool : Tool ) -> str :
236271 """Generate markdown documentation for a single tool.
237272
@@ -244,8 +279,11 @@ def tool_to_markdown(tool: Tool) -> str:
244279 lines = [f"### `{ tool .name } `" , "" ]
245280
246281 if tool .description :
247- lines .append (tool .description )
248- lines .append ("" )
282+ # Strip Args/Returns sections since we have a parameters table
283+ desc = _strip_docstring_sections (tool .description )
284+ if desc :
285+ lines .append (desc )
286+ lines .append ("" )
249287
250288 # Get parameters from schema
251289 schema = tool .schema ["function" ]
0 commit comments