move_wiki_page
Move Azure DevOps wiki pages to reorganize content structure. Specify project, wiki, source, and destination paths to relocate pages.
Instructions
Move a wiki page from one location to another atomically. Perfect for reorganizing wiki structure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | The name or ID of the project. | |
| wiki_identifier | Yes | The name or ID of the wiki. | |
| from_path | Yes | The current path of the wiki page to move. | |
| to_path | Yes | The target path where the wiki page should be moved. |
Implementation Reference
- The core implementation of the move_wiki_page tool. Retrieves the source page content, creates a new page at the target path with the same content, deletes the original page, and handles partial failures gracefully.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:824-849 (registration)Registers the move_wiki_page tool with the MCP server, including its description and input schema definition.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 handler dispatch that calls the Azure DevOps client's move_wiki_page method with unpacked arguments.elif name == "move_wiki_page": return self.client.move_wiki_page(**arguments)
- mcp_azure_devops/server.py:827-848 (schema)Input schema defining parameters for the move_wiki_page tool: project, wiki_identifier, from_path, to_path."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 }