Skip to main content
Glama

create_note

Create and save new notes with titles and content using this automation tool for organizing information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesNote title
contentYesNote content

Implementation Reference

  • The handler function that implements the core logic of the 'create_note' tool: parses arguments, validates title and content lengths, generates a sequential ID, stores the note in the global 'notes' object, and returns a formatted response or error.
    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
            };
        }
    };
  • The JSON schema defining the input parameters for the 'create_note' tool, including 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"]
    };
  • Dynamic registration code in loadTools function that imports the create_note module (based on filename), extracts the default handler, schema, and destroy function, and registers them in global tools and handlers maps using the filename 'create_note' as the tool name.
      const importPath = 'file://' + toolPath + (reload ? `?update=${Date.now()}` : '');
      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) {
  • Global in-memory storage object for notes created by the tool, shared with other handlers like ResourceHandler and PromptHandler.
    type Note = { title: string; content: string };
    export const notes: { [id: string]: Note } = {};
  • Cleanup function called during tool unload or reload to release resources.
    export async function destroy() {
        // Release resources, stop timers, disconnect, etc.
        console.log("Destroy create_note");
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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