move_wiki_page
Move a wiki page from one location to another within an Azure DevOps project to reorganize wiki structure atomically.
Instructions
Move a wiki page from one location to another atomically. Perfect for reorganizing wiki structure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_path | Yes | The current path of the wiki page to move. | |
| project | Yes | The name or ID of the project. | |
| to_path | Yes | The target path where the wiki page should be moved. | |
| wiki_identifier | Yes | The name or ID of the wiki. |
Implementation Reference
- Core handler function that implements the move_wiki_page tool logic: retrieves source page content, creates new page at target path, deletes original page, with error handling for partial success.def move_wiki_page(self, project, wiki_identifier, from_path, to_path): """ Move a wiki page from one location to another atomically. This involves getting the source content, creating at target, and deleting original. """ try: # Step 1: Get the source page content source_page = self.wiki_client.get_page( project=project, wiki_identifier=wiki_identifier, path=from_path, include_content=True ) if not source_page or not source_page.page: raise Exception(f"Source page '{from_path}' not found") source_content = source_page.page.content or "" # Step 2: Create the page at the target location try: target_page = self.create_wiki_page( project=project, wiki_identifier=wiki_identifier, path=to_path, content=source_content ) except Exception as create_error: raise Exception(f"Failed to create page at target location '{to_path}': {str(create_error)}") # Step 3: Delete the original page (only if creation succeeded) try: self.delete_wiki_page( project=project, wiki_identifier=wiki_identifier, path=from_path ) except Exception as delete_error: # If deletion fails, we should warn but not fail the whole operation # since the content is now at the target location return { "status": "partial_success", "message": f"Page moved to '{to_path}' but failed to delete original at '{from_path}': {str(delete_error)}", "from_path": from_path, "to_path": to_path, "target_page": { "path": target_page.page.path, "url": target_page.page.url }, "warning": f"Original page at '{from_path}' still exists and may need manual deletion" } # Success - both operations completed return { "status": "success", "message": f"Page successfully moved from '{from_path}' to '{to_path}'", "from_path": from_path, "to_path": to_path, "target_page": { "path": target_page.page.path, "url": target_page.page.url } } except Exception as e: # Complete failure - operation couldn't proceed raise Exception(f"Failed to move wiki page from '{from_path}' to '{to_path}': {str(e)}")
- mcp_azure_devops/server.py:823-849 (registration)Tool registration in MCP server, defining the name, description, and input schema for move_wiki_page.types.Tool( name="move_wiki_page", description="Move a wiki page from one location to another atomically. Perfect for reorganizing wiki structure.", 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." }, "from_path": { "type": "string", "description": "The current path of the wiki page to move." }, "to_path": { "type": "string", "description": "The target path where the wiki page should be moved." }, }, "required": ["project", "wiki_identifier", "from_path", "to_path"], "additionalProperties": False } ),
- mcp_azure_devops/server.py:1045-1046 (handler)MCP server dispatch handler that routes the tool call to the AzureDevOpsClient method.elif name == "move_wiki_page": return self.client.move_wiki_page(**arguments)
- mcp_azure_devops/server.py:826-848 (schema)Input schema defining parameters for the move_wiki_page tool: project, wiki_identifier, from_path, to_path.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." }, "from_path": { "type": "string", "description": "The current path of the wiki page to move." }, "to_path": { "type": "string", "description": "The target path where the wiki page should be moved." }, }, "required": ["project", "wiki_identifier", "from_path", "to_path"], "additionalProperties": False }