Skip to main content
Glama
Ucode-io

Postman MCP Generator

by Ucode-io

delete_data

Remove entity data from the Ucode Items API by specifying the identifier. Simplified deletion process integrated into the Postman MCP Generator for streamlined API interactions.

Instructions

Delete data from the Ucode Items API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe identifier of the entity to be deleted.

Implementation Reference

  • The core handler function `executeFunction` that sends a DELETE HTTP request to the Ucode Items API to delete the entity identified by `id`.
    const executeFunction = async ({ id }) => { const baseUrl = 'https://postman-rest-api-learner.glitch.me/'; const token = process.env.UCODE_PUBLIC_APIS_API_KEY; try { // Construct the URL with query parameters const url = new URL(`${baseUrl}/info`); url.searchParams.append('id', id); // Set up headers for the request const headers = { 'Content-Type': 'application/json' }; // Perform the fetch request const response = await fetch(url.toString(), { method: 'DELETE', headers }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(errorData); } // Return success message or response return { message: 'Data deleted successfully', status: response.status }; } catch (error) { console.error('Error deleting data:', error); return { error: 'An error occurred while deleting data.' }; } };
  • The `apiTool` object defining the tool's schema, including name 'delete_data', description, and input parameters schema requiring a string 'id'.
    const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'delete_data', description: 'Delete data from the Ucode Items API.', parameters: { type: 'object', properties: { id: { type: 'string', description: 'The identifier of the entity to be deleted.' } }, required: ['id'] } } } };
  • tools/paths.js:1-6 (registration)
    The list of tool file paths that includes the delete-data.js file, enabling its discovery.
    export const toolPaths = [ 'ucode-public-apis/ucode-items-ap-is/post-data.js', 'ucode-public-apis/ucode-items-ap-is/get-data.js', 'ucode-public-apis/ucode-items-ap-is/delete-data.js', 'ucode-public-apis/ucode-items-ap-is/update-data.js' ];
  • lib/tools.js:7-16 (registration)
    The `discoverTools` function that loads the `apiTool` from delete-data.js (via paths) and returns the list of tools used by the MCP server.
    export async function discoverTools() { const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }
  • mcpServer.js:82-160 (registration)
    In the MCP server startup, calls `discoverTools()` to load tools including 'delete_data' and passes them to `setupServerHandlers` to register ListTools and CallTool handlers.
    async function run() { const args = process.argv.slice(2); const isSSE = args.includes("--sse"); const tools = await discoverTools(); if (isSSE) { const app = express(); const transports = {}; const servers = {}; app.get("/sse", async (_req, res) => { // Create a new Server instance for each session const server = new Server( { name: SERVER_NAME, version: "0.1.0", }, { capabilities: { tools: {}, }, } ); server.onerror = (error) => console.error("[Error]", error); await setupServerHandlers(server, tools); const transport = new SSEServerTransport("/messages", res); transports[transport.sessionId] = transport; servers[transport.sessionId] = server; res.on("close", async () => { delete transports[transport.sessionId]; await server.close(); delete servers[transport.sessionId]; }); await server.connect(transport); }); app.post("/messages", async (req, res) => { const sessionId = req.query.sessionId; const transport = transports[sessionId]; const server = servers[sessionId]; if (transport && server) { await transport.handlePostMessage(req, res); } else { res.status(400).send("No transport/server found for sessionId"); } }); const port = process.env.PORT || 3001; app.listen(port, () => { console.log(`[SSE Server] running on port ${port}`); }); } else { // stdio mode: single server instance const server = new Server( { name: SERVER_NAME, version: "0.1.0", }, { capabilities: { tools: {}, }, } ); server.onerror = (error) => console.error("[Error]", error); await setupServerHandlers(server, tools); process.on("SIGINT", async () => { await server.close(); process.exit(0); }); const transport = new StdioServerTransport(); await server.connect(transport); }

Other Tools

Related 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/Ucode-io/mcp-server'

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