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
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The text content of the post to add. |
Implementation Reference
- src/index.ts:97-119 (handler)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, }; }
- src/index.ts:37-50 (schema)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); }