delete_post
Remove a Google Maps post by specifying its ID to manage location-based content.
Instructions
Deletes a post by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the post to delete. |
Implementation Reference
- src/index.ts:133-152 (handler)The handler function that implements the delete_post tool logic: searches for post by ID in the in-memory posts array, removes it if found, and returns appropriate success or error response.async function handleDeletePost(id: string) { console.error(`Handling delete_post request for ID: ${id}`); const initialLength = posts.length; const postIndex = posts.findIndex(post => post.id === id); if (postIndex === -1) { return { content: [{ type: "text", text: `Error: No post found with ID: ${id}` }], isError: true, }; } posts.splice(postIndex, 1); return { content: [{ type: "text", text: `Success! Post with ID: ${id} deleted.` }], isError: false, }; }
- src/index.ts:62-75 (schema)Tool definition including schema for delete_post: requires 'id' as string input.const DELETE_POST_TOOL: Tool = { name: "delete_post", description: "Deletes a post by ID.", inputSchema: { type: "object", properties: { id: { type: "string", description: "The ID of the post to delete.", }, }, required: ["id"], }, };
- src/index.ts:77-82 (registration)Registration of delete_post tool (DELETE_POST_TOOL) in the array of tools advertised via listTools endpoint.const SIMPLE_TOOLS = [ GET_WEATHER_TOOL, ADD_POST_TOOL, GET_POSTS_TOOL, DELETE_POST_TOOL, ] as const;
- src/index.ts:195-198 (registration)Dispatch logic in CallToolRequest handler switch statement that routes delete_post calls to the handleDeletePost function.case "delete_post": { const { id } = request.params.arguments as { id: string }; return await handleDeletePost(id); }