Skip to main content
Glama

Simple TypeScript MCP Server

by jasonkneen

createNote

Create and store notes with structured title and content using the MCP server. Manage note-taking operations efficiently with JSON-based CRUD functionality.

Input Schema

NameRequiredDescriptionDefault
contentYesThe content of the note
titleYesThe title of the note

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "content": { "description": "The content of the note", "type": "string" }, "title": { "description": "The title of the note", "type": "string" } }, "required": [ "title", "content" ], "type": "object" }

Implementation Reference

  • The main handler function for the MCP 'createNote' tool. It invokes notesStore.createNote and returns a standardized JSON response with success/error status.
    async ({ title, content }) => { try { const newNote = notesStore.createNote(title, content); return { content: [ { type: "text", text: JSON.stringify({ success: true, note: newNote }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to create note" }, null, 2) } ] }; } },
  • Zod input schema defining required string parameters 'title' and 'content' for the createNote tool.
    { title: z.string().describe("The title of the note"), content: z.string().describe("The content of the note") },
  • src/server.ts:101-136 (registration)
    Full registration of the 'createNote' MCP tool using server.tool(), including name, input schema, and inline handler function.
    server.tool( "createNote", { title: z.string().describe("The title of the note"), content: z.string().describe("The content of the note") }, async ({ title, content }) => { try { const newNote = notesStore.createNote(title, content); return { content: [ { type: "text", text: JSON.stringify({ success: true, note: newNote }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to create note" }, null, 2) } ] }; } }, );
  • Helper method in NotesStore class that generates a unique ID, creates a new Note object, stores it in memory, and returns it. Called by the MCP handler.
    createNote(title: string, content: string): Note { const id = `note${Date.now()}`; const newNote = { id, title, content, createdAt: new Date().toISOString() }; this.notes[id] = newNote; return newNote; }
  • TypeScript interface defining the structure of a Note object returned by createNote.
    export interface Note { id: string; title: string; content: string; createdAt: string; }

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

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