Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

wiki_get_page_content

Retrieve content from Azure DevOps wiki pages using unique identifiers and paths. Access specific project wikis and manage content efficiently with PAT authentication.

Instructions

Retrieve wiki page content by wikiIdentifier and path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe path of the wiki page to retrieve content for.
projectYesThe project name or ID where the wiki is located.
wikiIdentifierYesThe unique identifier of the wiki.

Implementation Reference

  • The core handler function that implements the wiki_get_page_content tool logic: connects to Azure DevOps, fetches the wiki page text as a stream using WikiApi.getPageText, converts it to string, and returns as JSON.
    async ({ wikiIdentifier, project, path }) => { try { const connection = await connectionProvider(); const wikiApi = await connection.getWikiApi(); const stream = await wikiApi.getPageText(project, wikiIdentifier, path, undefined, undefined, true); if (!stream) { return { content: [{ type: "text", text: "No wiki page content found" }], isError: true }; } const content = await streamToString(stream); return { content: [{ type: "text", text: JSON.stringify(content, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error fetching wiki page content: ${errorMessage}` }], isError: true, }; } }
  • Input schema validation using Zod for the tool parameters: wikiIdentifier, project, and path.
    wikiIdentifier: z.string().describe("The unique identifier of the wiki."), project: z.string().describe("The project name or ID where the wiki is located."), path: z.string().describe("The path of the wiki page to retrieve content for."), },
  • Direct registration of the wiki_get_page_content tool on the McpServer using server.tool, including description, schema, and handler.
    server.tool( WIKI_TOOLS.get_wiki_page_content, "Retrieve wiki page content by wikiIdentifier and path.", { wikiIdentifier: z.string().describe("The unique identifier of the wiki."), project: z.string().describe("The project name or ID where the wiki is located."), path: z.string().describe("The path of the wiki page to retrieve content for."), }, async ({ wikiIdentifier, project, path }) => { try { const connection = await connectionProvider(); const wikiApi = await connection.getWikiApi(); const stream = await wikiApi.getPageText(project, wikiIdentifier, path, undefined, undefined, true); if (!stream) { return { content: [{ type: "text", text: "No wiki page content found" }], isError: true }; } const content = await streamToString(stream); return { content: [{ type: "text", text: JSON.stringify(content, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error fetching wiki page content: ${errorMessage}` }], isError: true, }; } } );
  • src/tools.ts:26-26 (registration)
    High-level registration call to configureWikiTools, which sets up all wiki tools including wiki_get_page_content.
    configureWikiTools(server, tokenProvider, connectionProvider);
  • Helper function to convert the wiki page content stream to a string, used in the handler.
    function streamToString(stream: NodeJS.ReadableStream): Promise<string> { return new Promise((resolve, reject) => { let data = ""; stream.setEncoding("utf8"); stream.on("data", (chunk) => (data += chunk)); stream.on("end", () => resolve(data)); stream.on("error", reject); }); }

Other Tools

Related 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/ennuiii/DevOpsMcpPAT'

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