Skip to main content
Glama
W1seGit

Typst Universe MCP Server

by W1seGit

get_featured_packages

Retrieve featured Typst Universe packages to discover useful tools and templates 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 using Cheerio to extract featured packages, parses name, version, description from links, 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)
        );
    }
  • src/index.ts:72-79 (registration)
    Tool registration in the TOOLS array: defines name, description, and empty inputSchema (no parameters). This is returned by listTools.
    {
        name: 'get_featured_packages',
        description: 'Get a list of featured/popular packages from Typst Universe.',
        inputSchema: {
            type: 'object',
            properties: {},
        },
    },
  • MCP server request handler for tool calls: specifically the switch case that executes getFeaturedPackages(), handles empty results, formats output with formatPackage, and constructs the response content.
    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}`,
                },
            ],
        };
    }
  • TypeScript interface defining the structure of a TypstPackage, used as input to formatPackage and output type of getFeaturedPackages.
    export interface TypstPackage {
        name: string;
        version: string;
        description: string;
        url: string;
    }
  • Utility function to format a single TypstPackage into a readable string for inclusion in the tool response.
    function formatPackage(pkg: TypstPackage): string {
        return `📦 ${pkg.name} v${pkg.version}\n   ${pkg.description}\n   URL: ${pkg.url}`;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe traits like rate limits, authentication needs, pagination, or what 'featured/popular' means (e.g., curated vs. algorithmically determined). This leaves significant gaps for a tool that likely involves external data fetching.

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 that directly states the tool's purpose without any fluff or redundancy. It's front-loaded and wastes no words, making it easy for an agent to parse quickly.

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 simplicity (0 parameters, no output schema), the description is adequate as a basic overview. However, it lacks details on behavioral aspects (e.g., how 'featured/popular' is determined, response format) and usage context, which could help an agent use it more effectively. It's minimally viable but has clear gaps.

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

Parameters4/5

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

The tool has 0 parameters, and the schema description coverage is 100% (empty schema). The description doesn't need to explain parameters, so it meets the baseline expectation. No additional parameter information is required or provided, which is appropriate here.

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 ('Get a list') and resource ('featured/popular packages from Typst Universe'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_packages' or 'list_categories' beyond the 'featured/popular' qualifier, which prevents 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?

The description provides no guidance on when to use this tool versus alternatives like 'search_packages' or 'list_categories'. It mentions 'featured/popular' packages but doesn't clarify if this is for discovery, recommendations, or other contexts, leaving the agent to infer usage scenarios.

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

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