Skip to main content
Glama

update_wiki_page_safe

Safely update Azure DevOps wiki pages with automatic retry on version conflicts to maintain content accuracy.

Instructions

Safely updates a wiki page with automatic retry on version conflicts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesThe name or ID of the project.
wiki_identifierYesThe name or ID of the wiki.
pathYesThe path of the wiki page.
contentYesThe content of the wiki page.
max_retriesNoMaximum number of retry attempts (default: 3).

Implementation Reference

  • Core handler implementation that safely updates wiki pages with retry logic on version conflicts using ETag for optimistic concurrency.
    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")
  • Tool schema definition including input parameters and validation for update_wiki_page_safe.
    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
        }
    ),
  • Server-side dispatch handler that calls the client method and formats the response for the MCP protocol.
    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."
        }
  • Helper method that uses update_wiki_page_safe for upsert logic, falling back to create if not found.
    def create_or_update_wiki_page_smart(self, project, wiki_identifier, path, content):
        """
        Creates a new wiki page or updates existing one intelligently.
        """
        try:
            # Try to update first
            return self.update_wiki_page_safe(project, wiki_identifier, path, content)
        except Exception as e:
            if "not found" in str(e).lower() or "404" in str(e):
                # Page doesn't exist, create it
                return self.create_wiki_page(project, wiki_identifier, path, content)
            else:
                raise e
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it's a mutation tool ('updates'), has safety mechanisms ('safely'), and implements automatic retry logic for version conflicts. However, it doesn't mention permissions, rate limits, or what 'safely' entails beyond retries.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence efficiently conveys core functionality and key behavioral trait. Every word earns its place with no redundancy or unnecessary elaboration, making it perfectly front-loaded and concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description covers the basic 'what' and key safety behavior but lacks information about return values, error conditions, or detailed operational constraints. It's minimally adequate but has clear gaps given the complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 for adequate but not enhanced parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('updates a wiki page') with a key behavioral modifier ('safely' with 'automatic retry on version conflicts'). It distinguishes from sibling 'update_wiki_page' by emphasizing the safety mechanism, providing clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('on version conflicts') but doesn't explicitly state when to use this vs. the regular 'update_wiki_page' or other wiki-related tools. It provides clear functional context but lacks explicit alternative guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xrmghost/mcp-azure-devops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server