Skip to main content
Glama

send_message

Send a message to Duyet for collaboration, job opportunities, consulting, or general inquiries. Messages are saved with a reference ID for follow-up.

Instructions

Send a message to Duyet for collaboration, job opportunities, consulting, or general inquiries. Messages are saved with a reference ID for follow-up

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contact_emailNoOptional: Your email for response
messageYesMessage to send to Duyet (10-500 characters)
purposeYesPurpose of your message

Implementation Reference

  • The core handler function for the 'send_message' MCP tool. It performs rate limiting, inserts the message into the D1 database using the 'contacts' table, generates a reference ID, and returns a detailed success response or appropriate error messages.
    async ({ message, contact_email, purpose }) => { // Check rate limiting before processing const rateLimitCheck = await checkRateLimit(db, contact_email, purpose); if (!rateLimitCheck.allowed) { return { content: [ { type: "text", text: `Rate Limit Exceeded ${rateLimitCheck.reason} ${rateLimitCheck.retryAfter ? `You can try again in ${Math.ceil(rateLimitCheck.retryAfter / 60)} minutes.` : ""} Alternative: Email me directly at me@duyet.net`, }, ], isError: true, }; } // Extract metadata - simplified for MCP context const ip_address = "unknown"; const user_agent = "MCP Client"; const referenceId = crypto.randomUUID(); try { await db.insert(contacts).values({ message, contactEmail: contact_email, purpose: purpose, ipAddress: ip_address, userAgent: user_agent, referenceId, }); } catch (_e: any) { // Log error securely without exposing details return { content: [ { type: "text", text: "Your message was received but could not be saved to our system. Please try again or send your message directly via email at me@duyet.net.", }, ], }; } const timestamp = new Date().toLocaleString(); return { content: [ { type: "text", text: `Message Sent Successfully Reference ID: ${referenceId} Message: ${message} ${contact_email ? `Your Email: ${contact_email}` : ""} Purpose: ${purpose.replace("_", " ")} Submitted: ${timestamp} How to reach Duyet: Email: me@duyet.net LinkedIn: https://linkedin.com/in/duyet GitHub: https://github.com/duyet Your message has been recorded for follow-up. ${purpose === "job_opportunity" ? "\nFor Job Opportunities: Please include details about the role, company, and tech stack. Remote positions preferred." : ""} ${purpose === "consulting" ? "\nFor Consulting: Please provide project scope, timeline, and technical requirements." : ""}`, }, ], }; },
  • Input schema definition using Zod for validation of message, contact_email, and purpose parameters. Used in the MCP tool registration's inputSchema.
    const messageSchema = z.string().min(10).max(500) as any; const contactEmailSchema = z.string().email().optional() as any; const purposeSchema = z.enum(["collaboration", "job_opportunity", "consulting", "general_inquiry"]) as any; /** * Register the send_message MCP tool with D1 database integration */ export function registerSendMessageTool(server: McpServer, env: Env) { const db = getDb(env.DB); server.registerTool( "send_message", { title: "Send Message to Duyet", description: "Send a message to Duyet for collaboration, job opportunities, consulting, or general inquiries. Messages are saved with a reference ID for follow-up", inputSchema: { message: messageSchema.describe("Message to send to Duyet (10-500 characters)"), contact_email: contactEmailSchema.describe("Optional: Your email for response"), purpose: purposeSchema.describe("Purpose of your message"), }, },
  • Registers the 'send_message' tool with the MCP server, providing title, description, input schema, and handler function. Integrates with D1 database.
    export function registerSendMessageTool(server: McpServer, env: Env) { const db = getDb(env.DB); server.registerTool( "send_message", { title: "Send Message to Duyet", description: "Send a message to Duyet for collaboration, job opportunities, consulting, or general inquiries. Messages are saved with a reference ID for follow-up", inputSchema: { message: messageSchema.describe("Message to send to Duyet (10-500 characters)"), contact_email: contactEmailSchema.describe("Optional: Your email for response"), purpose: purposeSchema.describe("Purpose of your message"), }, }, async ({ message, contact_email, purpose }) => { // Check rate limiting before processing const rateLimitCheck = await checkRateLimit(db, contact_email, purpose); if (!rateLimitCheck.allowed) { return { content: [ { type: "text", text: `Rate Limit Exceeded ${rateLimitCheck.reason} ${rateLimitCheck.retryAfter ? `You can try again in ${Math.ceil(rateLimitCheck.retryAfter / 60)} minutes.` : ""} Alternative: Email me directly at me@duyet.net`, }, ], isError: true, }; } // Extract metadata - simplified for MCP context const ip_address = "unknown"; const user_agent = "MCP Client"; const referenceId = crypto.randomUUID(); try { await db.insert(contacts).values({ message, contactEmail: contact_email, purpose: purpose, ipAddress: ip_address, userAgent: user_agent, referenceId, }); } catch (_e: any) { // Log error securely without exposing details return { content: [ { type: "text", text: "Your message was received but could not be saved to our system. Please try again or send your message directly via email at me@duyet.net.", }, ], }; } const timestamp = new Date().toLocaleString(); return { content: [ { type: "text", text: `Message Sent Successfully Reference ID: ${referenceId} Message: ${message} ${contact_email ? `Your Email: ${contact_email}` : ""} Purpose: ${purpose.replace("_", " ")} Submitted: ${timestamp} How to reach Duyet: Email: me@duyet.net LinkedIn: https://linkedin.com/in/duyet GitHub: https://github.com/duyet Your message has been recorded for follow-up. ${purpose === "job_opportunity" ? "\nFor Job Opportunities: Please include details about the role, company, and tech stack. Remote positions preferred." : ""} ${purpose === "consulting" ? "\nFor Consulting: Please provide project scope, timeline, and technical requirements." : ""}`, }, ], }; }, ); }
  • Top-level invocation of send_message tool registration during the registerAllTools function, which sets up all MCP tools.
    registerSendMessageTool(server, env); logger.tool("send_message", "registered");

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/duyet/duyet-mcp-server'

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