Skip to main content
Glama
devqxi

Pub.dev MCP Server

by devqxi

search_packages

Search for Dart and Flutter packages on pub.dev using filters, sort options, and pagination to discover relevant dependencies.

Instructions

Search for packages on pub.dev with filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
sortNoSort order for results
pageNoPage number for pagination (default: 1)

Implementation Reference

  • The main handler function for the search_packages tool. It constructs a search URL for pub.dev API with query, sort, and page parameters, fetches results using cached fetch, processes the packages data, and returns a JSON-formatted response with search results.
    private async searchPackages(query: string, sort: string = 'top', page: number = 1) {
      const params = new URLSearchParams({
        q: query,
        sort: sort,
        page: page.toString()
      });
      
      const url = `https://pub.dev/api/search?${params}`;
      const data = await this.fetchWithCache<any>(url, `search-${query}-${sort}-${page}`);
      
      const results = {
        query,
        sort,
        page,
        totalResults: data.count,
        packages: data.packages.map((pkg: any) => ({
          name: pkg.package,
          version: pkg.latest.version,
          description: pkg.latest.pubspec?.description,
          points: pkg.points,
          likes: pkg.likes,
          popularity: pkg.popularity,
          publishedAt: pkg.latest.published
        }))
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(results, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the search_packages tool, specifying required 'query' parameter and optional 'sort' (enum) and 'page' parameters.
    {
      name: "search_packages",
      description: "Search for packages on pub.dev with filters",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query"
          },
          sort: {
            type: "string",
            enum: ["top", "text", "created", "updated", "popularity", "points", "likes"],
            description: "Sort order for results"
          },
          page: {
            type: "number",
            description: "Page number for pagination (default: 1)"
          }
        },
        required: ["query"]
      }
    }
  • Dispatcher registration in the CallToolRequestSchema handler that routes calls to the searchPackages method with parsed arguments.
    case "search_packages":
      return await this.searchPackages(
        args.query as string,
        args.sort as string,
        args.page as number
      );
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without behavioral details. It doesn't disclose rate limits, authentication needs, pagination behavior beyond the 'page' parameter, or what the search results include (e.g., metadata fields). This leaves gaps for an agent to understand operational constraints.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It front-loads the core purpose ('search for packages on pub.dev') and adds a useful qualifier ('with filters'). Every part earns its place, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool's moderate complexity (search with filters), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavior, output format, or usage context. With schema coverage high, the description meets a baseline but doesn't fully compensate for missing annotations and output information.

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%, so the schema already documents all parameters ('query', 'sort', 'page') with descriptions and enums. The description adds minimal value by mentioning 'filters', which loosely maps to parameters but doesn't provide additional semantics beyond what the schema specifies. Baseline 3 is appropriate as the schema does the heavy lifting.

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 action ('search for packages') and target resource ('on pub.dev'), with the addition of 'with filters' hinting at the parameter capabilities. It distinguishes from siblings like 'get_package_info' (specific package details) or 'compare_package_versions' (comparison), though not explicitly. However, it lacks specificity about what 'packages' entails (e.g., Dart/Flutter packages), keeping it from a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify if this is for broad searches versus using 'get_package_info' for known packages, or how it relates to 'check_package_updates' for monitoring changes. The description implies a general search function but offers no context on prerequisites or exclusions.

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