Add paragraph-level list formatting support to Google Docs
Enhanced the update_paragraph_style tool to support creating bulleted and numbered lists with nested indentation levels (0-8). This enables agents to create well-structured documents that match professional document styles. Changes: - Enhanced update_paragraph_style tool with: - create_list parameter: Create bulleted (UNORDERED) or numbered (ORDERED) lists - list_nesting_level parameter: Support nested list items (0-8 levels) - Updated create_bullet_list_request helper to accept nesting_level parameter - Updated documentation in README.md, docs/README.md, and docs/README_NEW.md - Tool remains in Extended tier as defined in tool_tiers.yaml This addresses the feature request to expose paragraph-level formatting operations (named styles, bullets, indentation) that were previously missing from the character-level modify_doc_text tool. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -279,7 +279,10 @@ def create_insert_image_request(
|
||||
|
||||
|
||||
def create_bullet_list_request(
|
||||
start_index: int, end_index: int, list_type: str = "UNORDERED"
|
||||
start_index: int,
|
||||
end_index: int,
|
||||
list_type: str = "UNORDERED",
|
||||
nesting_level: int = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Create a createParagraphBullets request for Google Docs API.
|
||||
@@ -288,6 +291,7 @@ def create_bullet_list_request(
|
||||
start_index: Start of text range to convert to list
|
||||
end_index: End of text range to convert to list
|
||||
list_type: Type of list ("UNORDERED" or "ORDERED")
|
||||
nesting_level: Nesting level (0-8, where 0 is top level). If None, uses default behavior.
|
||||
|
||||
Returns:
|
||||
Dictionary representing the createParagraphBullets request
|
||||
@@ -298,13 +302,19 @@ def create_bullet_list_request(
|
||||
else "NUMBERED_DECIMAL_ALPHA_ROMAN"
|
||||
)
|
||||
|
||||
return {
|
||||
request = {
|
||||
"createParagraphBullets": {
|
||||
"range": {"startIndex": start_index, "endIndex": end_index},
|
||||
"bulletPreset": bullet_preset,
|
||||
}
|
||||
}
|
||||
|
||||
# Add nesting level if specified
|
||||
if nesting_level is not None:
|
||||
request["createParagraphBullets"]["nestingLevel"] = nesting_level
|
||||
|
||||
return request
|
||||
|
||||
|
||||
def validate_operation(operation: Dict[str, Any]) -> tuple[bool, str]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user