Skip to main content
Glama

get_featured_packages

Retrieve featured and popular Typst packages from the Typst Universe registry to discover useful tools for document creation.

Instructions

Get a list of featured/popular packages from Typst Universe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that scrapes the Typst Universe homepage for featured packages using Cheerio, extracts package details, removes duplicates, and returns TypstPackage[]
    export async function getFeaturedPackages(): Promise<TypstPackage[]> { const html = await fetchPage(UNIVERSE_URL); const $ = cheerio.load(html); const packages: TypstPackage[] = []; // Featured packages are typically at the top of the main page $('a[href^="/universe/package/"]').slice(0, 20).each((_, element) => { const $el = $(element); const href = $el.attr('href'); if (!href) return; const text = $el.text().trim(); const match = text.match(/^([a-z0-9_-]+)(\d+\.\d+\.\d+)(.*)$/i); if (match) { const [, name, version, description] = match; packages.push({ name: name.trim(), version: version.trim(), description: description.trim(), url: `${BASE_URL}${href}`, }); } }); // Remove duplicates return packages.filter((pkg, index, self) => index === self.findIndex(p => p.name === pkg.name) ); }
  • Type definition for the output of getFeaturedPackages
    export interface TypstPackage { name: string; version: string; description: string; url: string; }
  • MCP tool schema definition including name, description, and empty input schema
    { name: 'get_featured_packages', description: 'Get a list of featured/popular packages from Typst Universe.', inputSchema: { type: 'object', properties: {}, }, }, ];
  • src/index.ts:254-277 (registration)
    Registration and dispatching logic in the tool call handler switch statement, which invokes getFeaturedPackages and formats the response for MCP
    case 'get_featured_packages': { const packages = await getFeaturedPackages(); if (packages.length === 0) { return { content: [ { type: 'text', text: 'No featured packages found.', }, ], }; } const formattedResults = packages.map(formatPackage).join('\n\n'); return { content: [ { type: 'text', text: `Featured packages (${packages.length}):\n\n${formattedResults}`, }, ], }; }
  • Helper function used to format individual package output in the tool response.
    function formatPackage(pkg: TypstPackage): string { return `📦 ${pkg.name} v${pkg.version}\n ${pkg.description}\n URL: ${pkg.url}`; }

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/W1seGit/Typst-Universe-MCP'

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