Skip to main content
Glama

get_deals

Retrieve current discounted PC component deals from meupc.net, including current price and lowest price in 90 days. Filter by category or page to find offers.

Instructions

Ofertas atuais com desconto no meupc.net, com preço atual e menor preço em 90 dias

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoNúmero da página
categoryNoFiltrar por categoria (ex: 'processadores', 'placas-video', 'memorias')

Implementation Reference

  • The main handler function that executes the 'get_deals' tool logic. It fetches deals from the meupc.net website, scrapes deal cards (name, price, discount, store), and returns results as JSON.
    export async function getDeals(params: GetDealsParams): Promise<string> {
      const { page, category } = params;
    
      let url = `/ofertas?page=${page}`;
      if (category) {
        url += `&peca=${encodeURIComponent(category)}`;
      }
    
      const root = await fetchPage(url);
      const results: DealResult[] = [];
    
      root.querySelectorAll("div.card.is-fullheight").forEach(card => {
        const name = card.querySelector(".card-content h3.title a")?.text.trim() ?? "";
        if (!name) return;
    
        const productUrl = card.querySelector(".card-content h3.title a")?.getAttribute("href") ?? "";
    
        const image = card.querySelector("header.card-image figure img")?.getAttribute("src") ?? null;
    
        // Loja
        const store = card.querySelector(".card-content p.uppertitle")?.text.trim()
          || card.querySelector("header.card-image div.loja-img img")?.getAttribute("alt")?.trim()
          || null;
    
        // Desconto (tag vermelha, ex: "-50%")
        const discount = card.querySelector(".card-content span.tag.is-danger")?.text.trim() || null;
    
        // Preço atual
        const currentPriceText = card.querySelector(".card-content a.preco")?.text.trim() ?? "";
        const currentPrice = parsePrice(currentPriceText) ?? 0;
    
        // Menor preço em 90 dias (no div.level.is-fullwidth)
        let oldPrice: number | null = null;
    
        card.querySelectorAll(".card-content div.level.is-fullwidth").forEach(lvl => {
          const text = lvl.text;
          if (text.includes("Menor") || text.includes("90 dias")) {
            const priceMatch = text.match(/R\$\s*([\d.,]+)/);
            if (priceMatch) {
              oldPrice = parsePrice(priceMatch[1]);
            }
          }
        });
    
        results.push({
          name,
          currentPrice,
          oldPrice,
          discount,
          store,
          url: absoluteUrl(productUrl),
          image: image ? absoluteUrl(image) : null,
        });
      });
    
      return JSON.stringify(results, null, 2);
    }
  • Zod schema defining the input parameters for 'get_deals': page (positive int, default 1) and optional category string.
    export const getDealsSchema = z.object({
      page: z.number().int().positive().default(1).describe("Número da página"),
      category: z.string().optional().describe("Filtrar por categoria (ex: 'processadores', 'placas-video', 'memorias')"),
    });
  • src/index.ts:43-50 (registration)
    Registration of the 'get_deals' tool on the MCP server, binding the schema and handler.
    server.tool(
      "get_deals",
      "Ofertas atuais com desconto no meupc.net, com preço atual e menor preço em 90 dias",
      getDealsSchema.shape,
      async (params) => ({
        content: [{ type: "text", text: await getDeals(params) }],
      })
    );
  • Imports for zod schema validation, scraper utilities (fetchPage, absoluteUrl, parsePrice), and the DealResult type.
    import { z } from "zod";
    import { fetchPage, absoluteUrl, parsePrice } from "../scraper.js";
    import type { DealResult } from "../types.js";
  • The DealResult type definition used as the return structure for deal data.
    export interface DealResult {
      name: string;
      currentPrice: number;
      oldPrice: number | null;
      discount: string | null;
      store: string | null;
      url: string;
      image: string | null;
    }
Behavior3/5

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

No annotations are provided, so the description bears full burden. It mentions the data returned but lacks details on pagination behavior, whether category filtering is supported (only hinted by schema), or any side effects.

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?

A single, well-structured sentence that immediately conveys the tool's purpose and key data points, with no superfluous information.

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

Completeness4/5

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

Given the simple nature of a list tool with no output schema, the description covers the essential purpose and data fields. However, it could mention that results are paginated and that the category filter is optional for full completeness.

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 coverage is 100% with descriptions for both parameters. The description adds context about the tool's output but does not elaborate on parameter usage beyond what the schema already provides.

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

Purpose5/5

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

The description clearly states 'Ofertas atuais com desconto' (current deals with discount) and specifies the included data (current price, lowest price in 90 days), distinctly differentiating from sibling tools focused on builds and components.

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

Usage Guidelines4/5

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

The context implies use when searching for discounted items on meupc.net, and siblings cover builds/components, but no explicit when-not or alternative naming is provided.

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/leosebben/mcp-meupc'

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