Skip to main content
Glama
Moe03

Google Maps MCP Server

by Moe03

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
NameRequiredDescriptionDefault
idYesThe ID of the post to delete.

Implementation Reference

  • 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,
      };
    }
  • 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);
    }
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/Moe03/mcp-hello-world'

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