update_wiki_page_safe
Update Azure DevOps wiki pages with automatic retry on version conflicts to prevent data loss during concurrent edits.
Instructions
Safely updates a wiki page with automatic retry on version conflicts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content of the wiki page. | |
| max_retries | No | Maximum number of retry attempts (default: 3). | |
| path | Yes | The path of the wiki page. | |
| project | Yes | The name or ID of the project. | |
| wiki_identifier | Yes | The name or ID of the wiki. |
Implementation Reference
- The main handler function that implements the safe update of a wiki page, including retry logic for version conflicts using ETag.def update_wiki_page_safe(self, project, wiki_identifier, path, content, max_retries=3): """ Safely updates a wiki page with automatic retry on version conflicts. """ for attempt in range(max_retries): try: # Get the latest version of the page page = self.wiki_client.get_page( project=project, wiki_identifier=wiki_identifier, path=path ) # Try to get ETag from various possible locations etag = None if hasattr(page, 'eTag'): etag = page.eTag elif hasattr(page, 'etag'): etag = page.etag elif hasattr(page, 'e_tag'): etag = page.e_tag elif hasattr(page, '_etag'): etag = page._etag elif hasattr(page, 'page') and hasattr(page.page, 'eTag'): etag = page.page.eTag elif hasattr(page, 'page') and hasattr(page.page, 'etag'): etag = page.page.etag elif hasattr(page, 'page') and hasattr(page.page, 'e_tag'): etag = page.page.e_tag parameters = { "content": content } return self.wiki_client.create_or_update_page( project=project, wiki_identifier=wiki_identifier, path=path, parameters=parameters, version=etag ) except Exception as e: if "version" in str(e).lower() and attempt < max_retries - 1: # Version conflict, retry with fresh version continue else: raise e raise Exception(f"Failed to update wiki page after {max_retries} attempts due to version conflicts")
- mcp_azure_devops/server.py:588-618 (schema)The tool schema definition including input parameters validation and description for the MCP protocol.types.Tool( name="update_wiki_page_safe", description="Safely updates a wiki page with automatic retry on version conflicts.", inputSchema={ "type": "object", "properties": { "project": { "type": "string", "description": "The name or ID of the project." }, "wiki_identifier": { "type": "string", "description": "The name or ID of the wiki." }, "path": { "type": "string", "description": "The path of the wiki page." }, "content": { "type": "string", "description": "The content of the wiki page." }, "max_retries": { "type": "integer", "description": "Maximum number of retry attempts (default: 3)." }, }, "required": ["project", "wiki_identifier", "path", "content"], "additionalProperties": False } ),
- mcp_azure_devops/server.py:1003-1010 (registration)The server-side dispatch and registration point where the tool call is routed to the client implementation and response is formatted.elif name == "update_wiki_page_safe": page = self.client.update_wiki_page_safe(**arguments) return { "path": page.page.path, "url": page.page.url, "content": page.page.content, "message": "Wiki page updated successfully with safe retry mechanism." }