Skip to main content
Glama

remove

Delete records from a UniCloud database collection using JQL query conditions to remove specific data entries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYes集合名称
whereYes查询条件 (JQL格式)

Implementation Reference

  • The direct handler function for the 'remove' MCP tool. Extracts collection and where parameters, calls removeFromDatabase to perform the deletion, and formats the response or error for MCP.
    async function handleRemoveTool(params, dbUrl) { const { collection, where } = params; try { const result = await removeFromDatabase(collection, where, dbUrl); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (error) { return { content: [{ type: 'text', text: error.message }], isError: true, }; } }
  • Core helper function that sends HTTP POST request to the uniCloud database service to delete records matching the where condition using JQL 'delete' action.
    async function removeFromDatabase(collection, where, dbUrl = DEFAULT_DB_URL) { try { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT); // 使用传入的dbUrl或默认URL const targetUrl = dbUrl || DEFAULT_DB_URL; // console.log('删除操作使用URL:', targetUrl); const response = await fetch(targetUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ operation: { collection, action: 'delete', where, }, }), signal: controller.signal, }); clearTimeout(timeoutId); const result = await response.json(); if (result.code !== 0) { throw new Error(result.msg || '删除失败'); } return result.data; } catch (error) { if (error.name === 'AbortError') { throw new Error(`删除超时: 请求超过${REQUEST_TIMEOUT}毫秒`); } throw new Error(`删除错误: ${error.message}`); } }
  • Tool definition including the Zod schema for input parameters (collection and where) and the handler wrapper.
    removeTool: { name: 'remove', params: { collection: z.string().describe('集合名称'), where: z.record(z.any()).describe('查询条件 (JQL格式)'), }, handler: (params) => handleRemoveTool(params, dbServiceUrl), },
  • index.js:52-56 (registration)
    Registers the 'remove' tool with the MCP server using its name, params schema, and handler.
    server.tool( tools.removeTool.name, tools.removeTool.params, tools.removeTool.handler );
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/6June6/uniclouddb-mcp'

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