get_wikis
Retrieve wiki details from Azure DevOps projects to access documentation and collaborative content for development teams.
Instructions
Get details of wikis in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | No | The ID or name of the organization (Default: mycompany) | |
| projectId | No | The ID or name of the project (Default: MyProject) |
Implementation Reference
- Core handler function that executes the 'get_wikis' tool logic: retrieves wikis from Azure DevOps Wiki API for a given organization and/or project, with comprehensive error handling.export async function getWikis( connection: WebApi, options: GetWikisOptions, ): Promise<WikiV2[]> { try { // Get the Wiki API client const wikiApi = await connection.getWikiApi(); // If a projectId is provided, get wikis for that specific project // Otherwise, get wikis for the entire organization const { projectId } = options; const wikis = await wikiApi.getAllWikis(projectId); return wikis || []; } catch (error) { // Handle resource not found errors specifically if ( error instanceof Error && error.message && error.message.includes('The resource cannot be found') ) { throw new AzureDevOpsResourceNotFoundError( `Resource not found: ${options.projectId ? `Project '${options.projectId}'` : 'Organization'}`, ); } // If it's already an AzureDevOpsError, rethrow it if (error instanceof AzureDevOpsError) { throw error; } // Otherwise, wrap it in a generic error throw new AzureDevOpsError( `Failed to get wikis: ${error instanceof Error ? error.message : String(error)}`, ); } }
- Zod schema for validating input arguments to the 'get_wikis' tool: optional organizationId and projectId.export const GetWikisSchema = z.object({ organizationId: z .string() .optional() .nullable() .describe(`The ID or name of the organization (Default: ${defaultOrg})`), projectId: z .string() .optional() .nullable() .describe(`The ID or name of the project (Default: ${defaultProject})`), });
- src/features/wikis/tool-definitions.ts:15-18 (registration)Registers the 'get_wikis' tool in the wikisTools array with its name, description, and JSON schema derived from GetWikisSchema.name: 'get_wikis', description: 'Get details of wikis in a project', inputSchema: zodToJsonSchema(GetWikisSchema), },
- src/features/wikis/index.ts:59-68 (handler)Dispatcher handler in handleWikisRequest that parses arguments with GetWikisSchema and invokes the getWikis function, formatting the response for MCP.case 'get_wikis': { const args = GetWikisSchema.parse(request.params.arguments); const result = await getWikis(connection, { organizationId: args.organizationId ?? defaultOrg, projectId: args.projectId ?? defaultProject, }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }