getTime
Retrieve the current server time from the Example MCP Server to synchronize applications or check system time.
Instructions
Get the current server time
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:46-51 (handler)The handler function for the 'getTime' tool. It generates the current date in ISO format and returns it as text content.async () => { const now = new Date().toISOString(); return { content: [{ type: "text", text: now }], }; }
- index.js:45-45 (schema)Input schema for 'getTime' tool using Zod. Empty object indicates no input parameters are required.{},
- index.js:42-52 (registration)Registration of the 'getTime' tool on the MCP server using server.tool(). Includes name, description, schema, and handler.server.tool( "getTime", "Get the current server time", {}, async () => { const now = new Date().toISOString(); return { content: [{ type: "text", text: now }], }; } );