Skip to main content
Glama

Travel MCP

by Erredebe
getCurrentTime.ts1.06 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; export function registerGetCurrentTime(server: McpServer) { server.tool( "get-current-time", "Fetch the current time on server", {}, async () => { const ctrl = new AbortController(); const id = setTimeout(() => ctrl.abort(), 8000); try { const response = new Date().toLocaleString(); const data = response; if (!data) { return { content: [ { type: "text", text: `No results image found.`, }, ], }; } return { content: [ { type: "text", text: response, }, ], }; } catch (err: any) { return { content: [ { type: "text", text: JSON.stringify({ error: err.message }), }, ], }; } finally { clearTimeout(id); } } ); }

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/Erredebe/travel-mcp'

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