Skip to main content
Glama
abcprintf

xmcp Application

by abcprintf
get-all-products.ts1.33 kB
import { ToolMetadata } from 'xmcp'; const baseUrl = 'https://backend.codingthailand.com'; export const metadata: ToolMetadata = { name: "get_all_products", description: "เครื่องมือสำหรับดึงข้อมูลสินค้าทั้งหมดจากระบบ", annotations: { title: "ดึงข้อมูลสินค้าทั้งหมด", readOnlyHint: true, destructiveHint: false, idempotentHint: true } }; export default async function getAllProducts() { try { const res = await fetch(`${baseUrl}/v2/products`); if (!res.ok) { return `เกิดข้อผิดพลาดจาก API: ${res.statusText}`; } const products = await res.json(); return { structuredContent: { products: products, total: products.length }, content: [ { type: 'text', text: `พบสินค้า ${products.length} รายการ` } ] } } catch (error) { return `เกิดข้อผิดพลาด: ${error instanceof Error ? error.message : "Unknown error"}`; } }

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/abcprintf/mcp-server-app'

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