getTime
Retrieve the current server time using the Example MCP Server. Designed for integration with AI assistants, this tool ensures accurate time fetching for time-sensitive applications.
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)The input schema for the 'getTime' tool, which is empty as it requires no parameters.{},
- index.js:42-52 (registration)Registration of the 'getTime' tool on the MCP server using server.tool(), specifying 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 }], }; } );