Skip to main content
Glama

create_note

Generate and store notes with a title and content using an automation tool designed for streamlined note creation on an enterprise-grade platform.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesNote content
titleYesNote title

Implementation Reference

  • Main handler function for the 'create_note' tool. It validates input title and content, generates a unique ID, stores the note in the global 'notes' object, and returns a success message with the note ID or an error response.
    export default async (request: any) => { try { const title = String(request.params.arguments?.title); const content = String(request.params.arguments?.content); if (!title || !content) { throw new Error("Title and content are required"); } if (title.length > 100) { throw new Error("Title must be less than 100 characters"); } if (content.length > 1000) { throw new Error("Content must be less than 1000 characters"); } const id = String(Object.keys(notes).length + 1); notes[id] = { title, content }; return { content: [ { type: "text", text: JSON.stringify({ message: `Created note ${id}: ${title}`, id: id }, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify(`Error creating note: ${error.message}`, null, 2), }, ], isError: true }; } };
  • JSON schema defining the input parameters for the 'create_note' tool: required 'title' and 'content' strings.
    export const schema = { name: "create_note", description: "Create a new note", type: "object", properties: { title: { type: "string", description: "Note title", }, content: { type: "string", description: "Note content", }, }, required: ["title", "content"] };
  • Type definition for Note and global storage object 'notes' used to persist created notes, shared with other handlers like ResourceHandler and PromptHandler.
    type Note = { title: string; content: string }; export const notes: { [id: string]: Note } = {};
  • Destroy function called during tool reload or shutdown to release resources.
    export async function destroy() { // Release resources, stop timers, disconnect, etc. console.log("Destroy create_note"); }
  • Dynamic registration of 'create_note' tool (derived from filename) during loadTools(): imports handler, schema, destroy; adds to tools list and handlers map.
    const { default: tool, schema, destroy } = await import(importPath); const toolName = path.parse(toolPath).name; // 注册工具 tools.push({ name: toolName, description: tool.description, inputSchema: schema, destroy: destroy }); // 注册处理函数 handlers[toolName] = async (request: ToolRequest) => { return await tool(request); }; } catch (error) {

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/xiaoguomeiyitian/ToolBox'

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