MCPcopy Create free account
hub / github.com/astercloud/aster / Delete

Method Delete

server/handlers/tool.go:263–293  ·  view source on GitHub ↗

Delete deletes a tool

(c *gin.Context)

Source from the content-addressed store, hash-verified

261
262// Delete deletes a tool
263func (h *ToolHandler) Delete(c *gin.Context) {
264 ctx := c.Request.Context()
265 id := c.Param("id")
266
267 if err := (*h.store).Delete(ctx, "tools", id); err != nil {
268 if errors.Is(err, store.ErrNotFound) {
269 c.JSON(http.StatusNotFound, gin.H{
270 "success": false,
271 "error": gin.H{
272 "code": "not_found",
273 "message": "Tool not found",
274 },
275 })
276 return
277 }
278 c.JSON(http.StatusInternalServerError, gin.H{
279 "success": false,
280 "error": gin.H{
281 "code": "internal_error",
282 "message": err.Error(),
283 },
284 })
285 return
286 }
287
288 logging.Info(ctx, "tool.deleted", map[string]any{
289 "id": id,
290 })
291
292 c.Status(http.StatusNoContent)
293}
294
295// Execute executes a tool
296func (h *ToolHandler) Execute(c *gin.Context) {

Callers

nothing calls this directly

Calls 6

InfoFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
DeleteMethod · 0.65
ErrorMethod · 0.65
StatusMethod · 0.45

Tested by

no test coverage detected