Skip to main content
Glama

get_documentation_changes

Retrieve and compare documentation content for Dart and Flutter packages. Specify package name, version, and doc type (e.g., readme, changelog) to track updates and changes efficiently.

Instructions

Get documentation content and detect changes for a package

Input Schema

NameRequiredDescriptionDefault
docTypeNoType of documentation to retrieve
packageNameYesName of the package to get documentation for
versionNoSpecific version (optional, defaults to latest)

Input Schema (JSON Schema)

{ "properties": { "docType": { "description": "Type of documentation to retrieve", "enum": [ "readme", "changelog", "example", "api_docs" ], "type": "string" }, "packageName": { "description": "Name of the package to get documentation for", "type": "string" }, "version": { "description": "Specific version (optional, defaults to latest)", "type": "string" } }, "required": [ "packageName" ], "type": "object" }

Implementation Reference

  • The main handler function that fetches the specified documentation type (readme, changelog, example, api_docs) for a Dart package from pub.dev, extracts text content, limits size, and returns structured JSON response.
    private async getDocumentationChanges(packageName: string, version?: string, docType: string = 'readme') { let baseUrl: string; if (version) { baseUrl = `https://pub.dev/packages/${packageName}/versions/${version}`; } else { baseUrl = `https://pub.dev/packages/${packageName}`; } let docUrl: string; let contentType: string; 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: string; 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: DocumentationChange = { type: docType as any, 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}`); } }
  • Tool registration in ListTools handler defining the name, description, and input schema with parameters packageName (required), version (optional), docType (enum: readme, changelog, example, api_docs).
    { 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"] } },
  • Switch case in CallToolRequestHandler that dispatches the tool call to the getDocumentationChanges handler method.
    case "get_documentation_changes": return await this.getDocumentationChanges( args.packageName as string, args.version as string, args.docType as string );
  • TypeScript interface defining the structure of the documentation change output used in the handler response.
    interface DocumentationChange { type: 'readme' | 'changelog' | 'example' | 'api_docs'; content: string; lastModified?: string; }
  • Helper function used by the handler to extract plain text from HTML documentation pages.
    private extractTextFromHtml(html: string): string { // Simple HTML tag removal - in production, consider using a proper HTML parser return html .replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '') .replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '') .replace(/<[^>]*>/g, '') .replace(/\s+/g, ' ') .trim(); }

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/devqxi/pubdev-mcp-server'

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