Skip to main content
Glama
Moe03

Google Maps MCP Server

by Moe03

add_post

Create and publish text content to Google Maps locations. Use this tool to share information, updates, or reviews directly on Google Maps through the MCP server interface.

Instructions

Adds a simple text post.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe text content of the post to add.

Implementation Reference

  • The main handler function that executes the add_post tool logic: validates the content input, creates a new Post object with a timestamp-based ID, adds it to the in-memory posts array, and returns a success message with the new post ID.
    async function handleAddPost(content: string) {
      console.error(`Handling add_post request with content: \"${content}\"`); // Log to stderr
      if (!content || typeof content !== 'string' || content.trim().length === 0) {
        return {
            content: [{ type: "text", text: "Error: Post content cannot be empty." }],
            isError: true,
        };
      }
      
      // Actually add the post to our array
      const newPost: Post = {
        id: Date.now().toString(),
        content,
        timestamp: Date.now()
      };
      
      posts.push(newPost);
      
      return {
        content: [{ type: "text", text: `Success! Post added with ID: ${newPost.id}` }],
        isError: false,
      };
    }
  • Tool definition including name, description, and input schema (requiring a 'content' string). This is used for validation and provided in listTools response.
    const ADD_POST_TOOL: Tool = {
      name: "add_post",
      description: "Adds a simple text post.",
      inputSchema: {
        type: "object",
        properties: {
          content: {
            type: "string",
            description: "The text content of the post to add.",
          },
        },
        required: ["content"],
      },
    };
  • src/index.ts:77-82 (registration)
    The add_post tool (ADD_POST_TOOL) is registered in the SIMPLE_TOOLS array, which is returned by the listTools handler.
    const SIMPLE_TOOLS = [
      GET_WEATHER_TOOL,
      ADD_POST_TOOL,
      GET_POSTS_TOOL,
      DELETE_POST_TOOL,
    ] as const;
  • src/index.ts:186-189 (registration)
    Dispatch case in the CallToolRequestSchema handler that extracts the 'content' argument and invokes the handleAddPost function.
    case "add_post": {
      const { content } = request.params.arguments as { content: string };
      return await handleAddPost(content);
    }
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