@@ -68,9 +68,9 @@ async def create_document(ctx: Context, title: str, text: str = "") -> Dict:
6868 return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_DOCUMENT" , title = title , text = text )
6969
7070@mcp .tool ()
71- async def get_document_by_id (ctx : Context , id : str ) -> Dict :
71+ async def get_document_by_id (ctx : Context , document_id : str ) -> Dict :
7272 """Retrieves an existing google document by its id."""
73- return await _execute_tool (ctx , "GOOGLEDOCS_GET_DOCUMENT_BY_ID" , id = id )
73+ return await _execute_tool (ctx , "GOOGLEDOCS_GET_DOCUMENT_BY_ID" , id = document_id )
7474
7575@mcp .tool ()
7676async def search_documents (ctx : Context , query : Optional [str ] = None , created_after : Optional [str ] = None , include_trashed : Optional [bool ] = None , max_results : int = 10 , modified_after : Optional [str ] = None , order_by : str = "modifiedTime desc" , shared_with_me : Optional [bool ] = None , starred_only : Optional [bool ] = None ) -> Dict :
@@ -93,19 +93,22 @@ async def create_footer(ctx: Context, document_id: str, type: str, section_break
9393 return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_FOOTER" , document_id = document_id , type = type , section_break_location = section_break_location )
9494
9595@mcp .tool ()
96- async def create_footnote (ctx : Context , documentId : str , endOfSegmentLocation : Optional [Dict ] = None , location : Optional [Dict ] = None ) -> Dict :
96+ async def create_footnote (ctx : Context , document_id : str , endOfSegmentLocation : Optional [Dict ] = None , location : Optional [Dict ] = None ) -> Dict :
9797 """Create a new footnote in a google document."""
98- return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_FOOTNOTE" , documentId = documentId , endOfSegmentLocation = endOfSegmentLocation , location = location )
98+ return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_FOOTNOTE" , documentId = document_id , endOfSegmentLocation = endOfSegmentLocation , location = location )
9999
100100@mcp .tool ()
101- async def create_header (ctx : Context , createHeader : Dict , documentId : str ) -> Dict :
101+ async def create_header (ctx : Context , document_id : str , type : str , section_break_location : Optional [ Dict ] = None ) -> Dict :
102102 """Create a new header in a google document."""
103- return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_HEADER" , createHeader = createHeader , documentId = documentId )
103+ createHeader_payload = {"type" : type }
104+ if section_break_location :
105+ createHeader_payload ["section_break_location" ] = section_break_location
106+ return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_HEADER" , createHeader = createHeader_payload , documentId = document_id )
104107
105108@mcp .tool ()
106- async def create_named_range (ctx : Context , documentId : str , name : str , rangeEndIndex : int , rangeStartIndex : int , rangeSegmentId : Optional [str ] = None ) -> Dict :
109+ async def create_named_range (ctx : Context , document_id : str , name : str , rangeEndIndex : int , rangeStartIndex : int , rangeSegmentId : Optional [str ] = None ) -> Dict :
107110 """Create a new named range in a google document."""
108- return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_NAMED_RANGE" , documentId = documentId , name = name , rangeEndIndex = rangeEndIndex , rangeStartIndex = rangeStartIndex , rangeSegmentId = rangeSegmentId )
111+ return await _execute_tool (ctx , "GOOGLEDOCS_CREATE_NAMED_RANGE" , documentId = document_id , name = name , rangeEndIndex = rangeEndIndex , rangeStartIndex = rangeStartIndex , rangeSegmentId = rangeSegmentId )
109112
110113@mcp .tool ()
111114async def create_paragraph_bullets (ctx : Context , createParagraphBullets : Dict , document_id : str ) -> Dict :
@@ -148,29 +151,29 @@ async def delete_table_column(ctx: Context, document_id: str, requests: List[Dic
148151 return await _execute_tool (ctx , "GOOGLEDOCS_DELETE_TABLE_COLUMN" , document_id = document_id , requests = requests )
149152
150153@mcp .tool ()
151- async def delete_table_row (ctx : Context , documentId : str , tableCellLocation : Dict ) -> Dict :
154+ async def delete_table_row (ctx : Context , document_id : str , tableCellLocation : Dict ) -> Dict :
152155 """Delete a row from a table in a google document."""
153- return await _execute_tool (ctx , "GOOGLEDOCS_DELETE_TABLE_ROW" , documentId = documentId , tableCellLocation = tableCellLocation )
156+ return await _execute_tool (ctx , "GOOGLEDOCS_DELETE_TABLE_ROW" , documentId = document_id , tableCellLocation = tableCellLocation )
154157
155158@mcp .tool ()
156159async def get_charts_from_spreadsheet (ctx : Context , spreadsheet_id : str ) -> Dict :
157160 """Retrieve a list of all charts from a specified google sheets spreadsheet."""
158161 return await _execute_tool (ctx , "GOOGLEDOCS_GET_CHARTS_FROM_SPREADSHEET" , spreadsheet_id = spreadsheet_id )
159162
160163@mcp .tool ()
161- async def insert_inline_image (ctx : Context , documentId : str , location : Dict , uri : str , objectSize : Optional [Dict ] = None ) -> Dict :
164+ async def insert_inline_image (ctx : Context , document_id : str , location : Dict , uri : str , objectSize : Optional [Dict ] = None ) -> Dict :
162165 """Insert an image from a given uri at a specified location."""
163- return await _execute_tool (ctx , "GOOGLEDOCS_INSERT_INLINE_IMAGE" , documentId = documentId , location = location , uri = uri , objectSize = objectSize )
166+ return await _execute_tool (ctx , "GOOGLEDOCS_INSERT_INLINE_IMAGE" , documentId = document_id , location = location , uri = uri , objectSize = objectSize )
164167
165168@mcp .tool ()
166- async def insert_page_break (ctx : Context , documentId : str , insertPageBreak : Dict ) -> Dict :
169+ async def insert_page_break (ctx : Context , document_id : str , insertPageBreak : Dict ) -> Dict :
167170 """Insert a page break into a google document."""
168- return await _execute_tool (ctx , "GOOGLEDOCS_INSERT_PAGE_BREAK" , documentId = documentId , insertPageBreak = insertPageBreak )
171+ return await _execute_tool (ctx , "GOOGLEDOCS_INSERT_PAGE_BREAK" , documentId = document_id , insertPageBreak = insertPageBreak )
169172
170173@mcp .tool ()
171- async def insert_table_action (ctx : Context , columns : int , documentId : str , rows : int , index : Optional [int ] = None , insertAtEndOfSegment : Optional [bool ] = None , segmentId : Optional [str ] = None , tabId : Optional [str ] = None ) -> Dict :
174+ async def insert_table_action (ctx : Context , columns : int , document_id : str , rows : int , index : Optional [int ] = None , insertAtEndOfSegment : Optional [bool ] = None , segmentId : Optional [str ] = None , tabId : Optional [str ] = None ) -> Dict :
172175 """Insert a table into a google document."""
173- return await _execute_tool (ctx , "GOOGLEDOCS_INSERT_TABLE_ACTION" , columns = columns , documentId = documentId , rows = rows , index = index , insertAtEndOfSegment = insertAtEndOfSegment , segmentId = segmentId , tabId = tabId )
176+ return await _execute_tool (ctx , "GOOGLEDOCS_INSERT_TABLE_ACTION" , columns = columns , documentId = document_id , rows = rows , index = index , insertAtEndOfSegment = insertAtEndOfSegment , segmentId = segmentId , tabId = tabId )
174177
175178@mcp .tool ()
176179async def insert_table_column (ctx : Context , document_id : str , requests : List [Dict ]) -> Dict :
@@ -208,9 +211,9 @@ async def update_document_style(ctx: Context, document_id: str, document_style:
208211 return await _execute_tool (ctx , "GOOGLEDOCS_UPDATE_DOCUMENT_STYLE" , document_id = document_id , document_style = document_style , fields = fields , tab_id = tab_id )
209212
210213@mcp .tool ()
211- async def update_table_row_style (ctx : Context , documentId : str , updateTableRowStyle : Dict ) -> Dict :
214+ async def update_table_row_style (ctx : Context , document_id : str , updateTableRowStyle : Dict ) -> Dict :
212215 """Update the style of a table row in a google document."""
213- return await _execute_tool (ctx , "GOOGLEDOCS_UPDATE_TABLE_ROW_STYLE" , documentId = documentId , updateTableRowStyle = updateTableRowStyle )
216+ return await _execute_tool (ctx , "GOOGLEDOCS_UPDATE_TABLE_ROW_STYLE" , documentId = document_id , updateTableRowStyle = updateTableRowStyle )
214217
215218if __name__ == "__main__" :
216219 host = os .getenv ("MCP_SERVER_HOST" , "127.0.0.1" )
0 commit comments