get_documentation_changes
Retrieve and compare documentation versions for Dart/Flutter packages to track updates in readme, changelog, examples, or API docs.
Instructions
Get documentation content and detect changes for a package
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| packageName | Yes | Name of the package to get documentation for | |
| version | No | Specific version (optional, defaults to latest) | |
| docType | No | Type of documentation to retrieve |
Implementation Reference
- src/pubdev-mcp.js:288-352 (handler)The core handler function `getDocumentationChanges` that implements the tool logic: constructs URL based on docType, fetches content from pub.dev, extracts text from HTML (except API docs), limits content size, and returns JSON with documentation details.async getDocumentationChanges(packageName, version, docType = 'readme') { let baseUrl; if (version) { baseUrl = `https://pub.dev/packages/${packageName}/versions/${version}`; } else { baseUrl = `https://pub.dev/packages/${packageName}`; } let docUrl; let contentType; switch (docType) { case 'readme': docUrl = `${baseUrl}/readme`; contentType = 'README'; break; case 'changelog': docUrl = `${baseUrl}/changelog`; contentType = 'CHANGELOG'; break; case 'example': docUrl = `${baseUrl}/example`; contentType = 'Example'; break; case 'api_docs': docUrl = `https://pub.dev/documentation/${packageName}/${version || 'latest'}/`; contentType = 'API Documentation'; break; default: throw new Error(`Unsupported documentation type: ${docType}`); } try { const response = await fetch(docUrl); let content; if (response.ok) { content = await response.text(); // Extract meaningful content from HTML if needed if (docType !== 'api_docs') { content = this.extractTextFromHtml(content); } } else { content = `${contentType} not available for this package/version`; } const docChange = { type: docType, content: content.substring(0, 5000), // Limit content size lastModified: response.headers.get('last-modified') || undefined }; return { content: [ { type: "text", text: JSON.stringify({ packageName, version: version || 'latest', documentationType: docType, documentation: docChange }, null, 2) } ] }; } catch (error) { throw new Error(`Failed to fetch documentation: ${error}`); }
- src/pubdev-mcp.js:75-97 (registration)Tool registration in the ListToolsRequestHandler, defining the tool name, description, and input schema.{ name: "get_documentation_changes", description: "Get documentation content and detect changes for a package", inputSchema: { type: "object", properties: { packageName: { type: "string", description: "Name of the package to get documentation for" }, version: { type: "string", description: "Specific version (optional, defaults to latest)" }, docType: { type: "string", enum: ["readme", "changelog", "example", "api_docs"], description: "Type of documentation to retrieve" } }, required: ["packageName"] } },
- src/pubdev-mcp.js:78-96 (schema)Input schema for the tool, validating packageName (required string), optional version string, and docType string with enum values.inputSchema: { type: "object", properties: { packageName: { type: "string", description: "Name of the package to get documentation for" }, version: { type: "string", description: "Specific version (optional, defaults to latest)" }, docType: { type: "string", enum: ["readme", "changelog", "example", "api_docs"], description: "Type of documentation to retrieve" } }, required: ["packageName"] }
- src/pubdev-mcp.js:160-161 (helper)Switch case dispatcher in CallToolRequestHandler that invokes the getDocumentationChanges handler with parsed arguments.case "get_documentation_changes": return await this.getDocumentationChanges(args.packageName, args.version, args.docType);
- src/pubdev-mcp.ts:32-36 (schema)TypeScript interface defining the structure of the documentation change output used in the handler.interface DocumentationChange { type: 'readme' | 'changelog' | 'example' | 'api_docs'; content: string; lastModified?: string; }