Skip to main content
Glama
stefanskiasan

Azure DevOps MCP Server for Cline

update_wiki_page

Create or modify Azure DevOps wiki pages with markdown content to maintain project documentation and share knowledge across teams.

Instructions

Create or update a wiki page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wikiIdentifierYesWiki identifier
pathYesPage path
contentYesPage content in markdown format
commentNoComment for the update (optional)

Implementation Reference

  • Core handler function that implements the logic for updating a wiki page, including validation, wiki retrieval, and response formatting (noting current API limitations).
    export async function updateWikiPage(args: UpdateWikiPageArgs, config: AzureDevOpsConfig) {
      if (!args.wikiIdentifier || !args.path || !args.content) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Wiki identifier, page path, and content are required'
        );
      }
    
      AzureDevOpsConnection.initialize(config);
      const connection = AzureDevOpsConnection.getInstance();
      const wikiApi = await connection.getWikiApi();
    
      try {
        const wiki = await wikiApi.getWiki(config.project, args.wikiIdentifier);
        if (!wiki || !wiki.id) {
          throw new McpError(
            ErrorCode.InvalidParams,
            `Wiki ${args.wikiIdentifier} not found`
          );
        }
    
        const updateParams = {
          content: args.content,
          comment: args.comment || `Updated page ${args.path}`,
        };
    
        // Da die Wiki-API keine direkte Methode zum Aktualisieren von Seiten bietet,
        // geben wir vorerst nur die Wiki-Informationen zurück
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                wiki,
                path: args.path,
                message: 'Wiki page update is not supported in the current API version',
                requestedUpdate: updateParams
              }, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        if (error instanceof McpError) throw error;
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to update wiki page: ${errorMessage}`
        );
      }
    }
  • Tool input schema definition for update_wiki_page, specifying parameters and requirements.
    {
      name: 'update_wiki_page',
      description: 'Create or update a wiki page',
      inputSchema: {
        type: 'object',
        properties: {
          wikiIdentifier: {
            type: 'string',
            description: 'Wiki identifier',
          },
          path: {
            type: 'string',
            description: 'Page path',
          },
          content: {
            type: 'string',
            description: 'Page content in markdown format',
          },
          comment: {
            type: 'string',
            description: 'Comment for the update (optional)',
          },
        },
        required: ['wikiIdentifier', 'path', 'content'],
      },
    },
  • Registration of wiki tools including the updateWikiPage handler binding and definitions export.
    export const wikiTools = {
      initialize: (config: AzureDevOpsConfig) => ({
        getWikis: (args: Record<string, never>) => getWikis(args, config),
        getWikiPage: (args: { wikiIdentifier: string; path: string; version?: string; includeContent?: boolean }) =>
          getWikiPage(args, config),
        createWiki: (args: { name: string; projectId?: string; mappedPath?: string }) =>
          createWiki(args, config),
        updateWikiPage: (args: { wikiIdentifier: string; path: string; content: string; comment?: string }) =>
          updateWikiPage(args, config),
        definitions,
      }),
      definitions,
    };
  • src/index.ts:148-150 (registration)
    Main server dispatch/registration for the update_wiki_page tool call.
    case 'update_wiki_page':
      result = await tools.wiki.updateWikiPage(request.params.arguments);
      break;
  • TypeScript interface defining the arguments for the updateWikiPage function.
    interface UpdateWikiPageArgs {
      wikiIdentifier: string;
      path: string;
      content: string;
      comment?: string;
    }
  • WikiApi class method for updating wiki pages via direct API fetch (PUT request), used as helper in the tool ecosystem.
    async updateWikiPage(
      wikiIdentifier: string,
      path: string,
      content: string,
      comment?: string
    ): Promise<WikiPageUpdateResponse> {
      const authHeader = await this.getAuthHeader();
      const encodedPath = encodeURIComponent(path);
      const response = await fetch(
        `${this.baseUrl}/${wikiIdentifier}/pages?path=${encodedPath}&api-version=7.0`,
        {
          method: 'PUT',
          headers: {
            'Content-Type': 'application/json',
            Authorization: authHeader,
          },
          body: JSON.stringify({
            content,
            comment: comment || `Updated page ${path}`,
          }),
        }
      );
    
      if (response.status === 404) {
        if (response.statusText.includes('Wiki not found')) {
          throw new WikiNotFoundError(wikiIdentifier);
        }
        throw new WikiPageNotFoundError(wikiIdentifier, path);
      }
    
      if (!response.ok) {
        throw new WikiError(
          `Failed to update wiki page: ${response.statusText}`,
          response.status,
          wikiIdentifier,
          path,
          await response.text()
        );
      }
    
      return response.json();
    }

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/stefanskiasan/azure-devops-mcp-server'

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