Skip to main content
Glama
devqxi

Pub.dev MCP Server

by devqxi

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
NameRequiredDescriptionDefault
packageNameYesName of the package to get documentation for
versionNoSpecific version (optional, defaults to latest)
docTypeNoType of documentation to retrieve

Implementation Reference

  • 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}`);
        }
  • 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"]
        }
    },
  • 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"]
    }
  • 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);
  • 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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'detect changes,' implying some analysis or comparison, but doesn't explain how changes are detected (e.g., compared to previous versions, over time), what the output includes, or any constraints like rate limits or authentication needs. For a tool with potential complexity in change detection, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Get documentation content and detect changes for a package.' It is front-loaded with the core purpose and avoids unnecessary words. However, it could be slightly more structured by separating the two functions (getting content and detecting changes) for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity implied by 'detect changes' and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'detect changes' entails, the return format, or how results are presented. For a tool that likely involves analysis and comparison, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for all parameters (packageName, version, docType). The description adds no additional parameter semantics beyond what the schema provides, such as format details or usage examples. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get documentation content and detect changes for a package.' It specifies the verb ('get' and 'detect changes') and resource ('documentation content'), making it clear what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_package_info' or 'check_package_updates', which might also involve package information retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'check_package_updates' or 'get_package_info', nor does it specify prerequisites, exclusions, or contexts for usage. This leaves the agent without clear direction on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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