hash-sha256
Generate SHA256 hash for any text input to ensure data integrity. Use this tool for secure hashing needs within the IT Tools MCP Server.
Instructions
Generate SHA256 hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to hash with SHA256 |
Implementation Reference
- The handler function that takes input text, computes its SHA256 hash using Node.js 'crypto' createHash, and returns the hex digest formatted as text content.}, async ({ text }) => { const hash = createHash('sha256'); hash.update(text); const result = hash.digest('hex'); return { content: [ { type: "text", text: `SHA256 hash: ${result}`, }, ], }; }
- Zod schema defining the input: a string 'text' to be hashed.inputSchema: { text: z.string().describe("Text to hash with SHA256"), },
- src/tools/crypto/hash_sha256/index.ts:5-31 (registration)The registration function exports registerHashSha256 which calls server.registerTool for 'hash_sha256' with description, schema, annotations, and handler.export function registerHashSha256(server: McpServer) { server.registerTool("hash_sha256", { description: 'Generate SHA256 hash of input text. Example: "hello" → "2cf24dba4f21d..."', inputSchema: { text: z.string().describe("Text to hash with SHA256"), }, // VS Code compliance annotations annotations: { title: "Hash Sha256", description: "Generate SHA256 hash of input text", readOnlyHint: false } }, async ({ text }) => { const hash = createHash('sha256'); hash.update(text); const result = hash.digest('hex'); return { content: [ { type: "text", text: `SHA256 hash: ${result}`, }, ], }; } ); }