/**
* 工具定義(靜態)
* 這些定義會在 MCP Server 啟動時載入
* 實際執行會轉發到 Cloud Run Backend
*/
export const toolDefinitions = [
// Odoo 工具
{
name: 'odoo_search',
description: '搜尋 Odoo 資料',
inputSchema: {
type: 'object',
properties: {
model: { type: 'string', description: 'Odoo 模型名稱,例如 res.partner, product.product, purchase.order' },
domain: { type: 'array', description: '搜尋條件,Odoo domain 格式' },
fields: { type: 'array', items: { type: 'string' }, description: '要返回的欄位列表' },
limit: { type: 'number', description: '返回記錄數量限制,預設 20', default: 20 },
offset: { type: 'number', description: '跳過的記錄數(分頁用)', default: 0 },
order: { type: 'string', description: '排序方式,例如 "name asc" 或 "create_date desc"' },
},
required: ['model'],
},
},
{
name: 'odoo_read',
description: '讀取指定 ID 的 Odoo 記錄',
inputSchema: {
type: 'object',
properties: {
model: { type: 'string', description: 'Odoo 模型名稱' },
ids: { type: 'array', items: { type: 'number' }, description: '記錄 ID 列表' },
fields: { type: 'array', items: { type: 'string' }, description: '要返回的欄位列表' },
},
required: ['model', 'ids'],
},
},
{
name: 'odoo_count',
description: '計算符合條件的 Odoo 記錄數',
inputSchema: {
type: 'object',
properties: {
model: { type: 'string', description: 'Odoo 模型名稱' },
domain: { type: 'array', description: '搜尋條件' },
},
required: ['model'],
},
},
{
name: 'odoo_create',
description: '建立 Odoo 記錄(僅 admin/assistant 可用)',
inputSchema: {
type: 'object',
properties: {
model: { type: 'string', description: 'Odoo 模型名稱' },
values: { type: 'object', description: '要建立的欄位和值' },
},
required: ['model', 'values'],
},
},
{
name: 'odoo_update',
description: '更新 Odoo 記錄(僅 admin/assistant 可用)',
inputSchema: {
type: 'object',
properties: {
model: { type: 'string', description: 'Odoo 模型名稱' },
ids: { type: 'array', items: { type: 'number' }, description: '要更新的記錄 ID 列表' },
values: { type: 'object', description: '要更新的欄位和值' },
},
required: ['model', 'ids', 'values'],
},
},
{
name: 'odoo_delete',
description: '刪除 Odoo 記錄(僅 admin/assistant 可用)',
inputSchema: {
type: 'object',
properties: {
model: { type: 'string', description: 'Odoo 模型名稱' },
ids: { type: 'array', items: { type: 'number' }, description: '要刪除的記錄 ID 列表' },
},
required: ['model', 'ids'],
},
},
// Shopify 工具
{
name: 'shopify_search_products',
description: '搜尋 Shopify 產品',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: '搜尋關鍵字(產品名稱、SKU 等)' },
limit: { type: 'number', description: '返回數量限制,預設 20', default: 20 },
cursor: { type: 'string', description: '分頁游標(用於取得下一頁)' },
},
},
},
{
name: 'shopify_get_product',
description: '取得單一 Shopify 產品詳情',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: '產品 ID(格式:gid://shopify/Product/xxxxx)' },
},
required: ['id'],
},
},
{
name: 'shopify_update_product',
description: '更新 Shopify 產品(僅 admin/assistant 可用)',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: '產品 ID' },
title: { type: 'string', description: '新產品名稱' },
bodyHtml: { type: 'string', description: '產品描述(HTML)' },
status: { type: 'string', enum: ['ACTIVE', 'DRAFT', 'ARCHIVED'], description: '產品狀態' },
},
required: ['id'],
},
},
{
name: 'shopify_update_price',
description: '更新 Shopify 產品變體價格(僅 admin/assistant 可用)',
inputSchema: {
type: 'object',
properties: {
variantId: { type: 'string', description: '變體 ID(格式:gid://shopify/ProductVariant/xxxxx)' },
price: { type: 'string', description: '新價格' },
},
required: ['variantId', 'price'],
},
},
{
name: 'shopify_get_locations',
description: '取得 Shopify 庫存位置列表',
inputSchema: {
type: 'object',
properties: {},
},
},
// 知識庫工具
{
name: 'knowledge_search',
description: '搜尋產品知識庫',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: '搜尋關鍵字' },
category: { type: 'string', enum: ['tiles', 'flooring', 'bathroom', 'countertops'], description: '產品分類(可選)' },
repo: { type: 'string', enum: ['internal', 'alliance', 'all'], description: '搜尋範圍,預設為 all', default: 'all' },
limit: { type: 'number', description: '返回數量限制,預設 20', default: 20 },
},
required: ['query'],
},
},
{
name: 'knowledge_get_file',
description: '讀取知識庫檔案內容',
inputSchema: {
type: 'object',
properties: {
repo: { type: 'string', enum: ['internal', 'alliance', 'products'], description: '來源 repo' },
path: { type: 'string', description: '檔案路徑' },
},
required: ['repo', 'path'],
},
},
{
name: 'knowledge_list_directory',
description: '列出知識庫目錄內容',
inputSchema: {
type: 'object',
properties: {
repo: { type: 'string', enum: ['internal', 'alliance', 'products'], description: '來源 repo' },
path: { type: 'string', description: '目錄路徑(可選,預設為根目錄)' },
},
required: ['repo'],
},
},
{
name: 'knowledge_get_price',
description: '查詢產品價格(含成本,僅內部可用)',
inputSchema: {
type: 'object',
properties: {
sku: { type: 'string', description: '產品 SKU' },
},
required: ['sku'],
},
},
{
name: 'knowledge_search_spec',
description: '搜尋產品規格',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: '搜尋關鍵字(產品名、規格等)' },
category: { type: 'string', enum: ['tiles', 'flooring', 'bathroom', 'countertops'], description: '產品分類' },
},
required: ['query'],
},
},
]