Skip to main content
Glama
ecosyste-ms

Ecosyste.ms Package Data

Official
by ecosyste-ms

search_packages

Find packages by keyword across all ecosystems to locate packages that perform specific functions.

Instructions

Find packages by keyword across all ecosystems. Use when looking for packages that do something specific.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesKeywords to search for
limitNoMax results (default 20)

Implementation Reference

  • Core handler function that executes the package search using full-text search (FTS5) on the local SQLite database, handling query quoting for special characters.
    export function searchPackagesInDb(query, limit = 20) {
      if (!db) return null;
      // Quote the query to handle special FTS5 characters like hyphens
      // FTS5 treats - as NOT operator, so "better-sqlite3" becomes "better NOT sqlite3"
      // Quoting the entire phrase treats it as a literal search
      const quotedQuery = `"${query.replace(/"/g, '""')}"`;
      return db
        .prepare(
          `SELECT p.ecosystem, p.name, p.description, p.licenses, p.downloads,
            p.dependent_packages_count, p.repository_url
           FROM packages p
           JOIN packages_fts fts ON p.id = fts.rowid
           WHERE packages_fts MATCH ?
           LIMIT ?`
        )
        .all(quotedQuery, limit);
    }
  • Input schema definition for the 'search_packages' tool, specifying query and optional limit parameters.
      name: "search_packages",
      description:
        "Find packages by keyword across all ecosystems. Use when looking for packages that do something specific.",
      inputSchema: {
        type: "object",
        properties: {
          query: { type: "string", description: "Keywords to search for" },
          limit: { type: "number", description: "Max results (default 20)" },
        },
        required: ["query"],
      },
    },
  • index.js:153-160 (registration)
    Tool handler registration in the switch statement of handleToolCall, which checks for database availability, calls the search function, and formats the output.
    case "search_packages": {
      if (!getDb()) {
        return "Search requires local database. No database loaded.";
      }
    
      const results = searchPackagesInDb(args.query, args.limit || 20);
      return `Search results for "${args.query}":\n\n${formatSearchResults(results)}`;
    }
  • index.js:239-241 (registration)
    Registration of the ListTools handler that returns the tools array including 'search_packages' schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { 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/ecosyste-ms/mcp'

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