Skip to main content
Glama
Moe03

Google Maps MCP Server

by Moe03

add_post

Easily create and publish text posts through the Google Maps MCP Server, enabling users to share content directly within the platform.

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 for the 'add_post' tool. Validates input content, generates a unique ID using timestamp, adds the post to an in-memory array, and returns a success response with the new post ID or an error if content is invalid.
    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 schema definition for 'add_post', specifying name, description, and input schema requiring a 'content' string property.
    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)
    Registers the ADD_POST_TOOL in the SIMPLE_TOOLS array, which is returned in response to ListTools requests.
    const SIMPLE_TOOLS = [ GET_WEATHER_TOOL, ADD_POST_TOOL, GET_POSTS_TOOL, DELETE_POST_TOOL, ] as const;
  • src/index.ts:186-189 (registration)
    In the CallToolRequest handler's switch statement, handles 'add_post' by extracting 'content' from arguments and invoking handleAddPost.
    case "add_post": { const { content } = request.params.arguments as { content: string }; return await handleAddPost(content); }

Other Tools

Related 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