Skip to main content
Glama
disnet
by disnet

create_note

Create single or multiple notes with specified types, titles, and markdown content in the Flint Note system for organized AI collaboration.

Instructions

Create one or more notes of the specified type(s)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoNote type (must exist) - only used for single note creation
titleNoTitle of the note - only used for single note creation
contentNoContent of the note in markdown format - only used for single note creation
metadataNoAdditional metadata fields for the note (validated against note type schema) - only used for single note creation
notesNoArray of notes to create - used for batch creation
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.

Implementation Reference

  • MCP tool handler for 'create_note'. Validates args, handles single or batch note creation via noteManager.createNote or batchCreateNotes, appends agent instructions.
    handleCreateNote = async (args: CreateNoteArgs) => {
      // Validate arguments
      validateToolArgs('create_note', args);
    
      const { noteManager, noteTypeManager } = await this.resolveVaultContext(
        args.vault_id
      );
    
      // Handle batch creation if notes array is provided
      if (args.notes) {
        const result = await noteManager.batchCreateNotes(args.notes);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      }
    
      // Handle single note creation
      if (!args.type || !args.title || !args.content) {
        throw new Error('Single note creation requires type, title, and content');
      }
    
      const noteInfo = await noteManager.createNote(
        args.type,
        args.title,
        args.content,
        args.metadata || {}
      );
    
      // Get agent instructions for this note type
      let agentInstructions: string[] = [];
      let nextSuggestions = '';
      try {
        const typeInfo = await noteTypeManager.getNoteTypeDescription(args.type);
        agentInstructions = typeInfo.parsed.agentInstructions;
        if (agentInstructions.length > 0) {
          nextSuggestions = `Consider following these guidelines for ${args.type} notes: ${agentInstructions.join(', ')}`;
        }
      } catch {
        // Ignore errors getting type info, continue without instructions
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              {
                ...noteInfo,
                agent_instructions: agentInstructions,
                next_suggestions: nextSuggestions
              },
              null,
              2
            )
          }
        ]
      };
    };
  • JSON schema definition for the 'create_note' tool input, supporting single note or batch creation via 'notes' array.
    name: 'create_note',
    description: 'Create one or more notes of the specified type(s)',
    inputSchema: {
      type: 'object',
      properties: {
        type: {
          type: 'string',
          description: 'Type of note to create'
        },
        title: {
          type: 'string',
          description: 'Title of the note'
        },
        content: {
          type: 'string',
          description: 'Content of the note in markdown format',
          default: ''
        },
        metadata: {
          type: 'object',
          description: 'Additional metadata for the note'
        },
        vault_id: {
          type: 'string',
          description:
            'Optional vault ID to create the note in. If not provided, uses the current active vault.'
        },
        notes: {
          type: 'array',
          items: {
            type: 'object',
            properties: {
              type: {
                type: 'string',
                description: 'Type of note to create'
              },
              title: {
                type: 'string',
                description: 'Title of the note'
              },
              content: {
                type: 'string',
                description: 'Content of the note in markdown format',
                default: ''
              },
              metadata: {
                type: 'object',
                description: 'Additional metadata for the note'
              }
            },
            required: ['type', 'title']
          },
          description:
            'Array of notes to create in batch (alternative to single note creation)'
        }
      },
      oneOf: [
        {
          required: ['type', 'title']
        },
        {
          required: ['notes']
        }
      ]
    }
  • Registration of 'create_note' handler in the MCP CallToolRequestSchema switch statement, dispatching to noteHandlers.handleCreateNote
    return await this.noteHandlers.handleCreateNote(
      args as unknown as CreateNoteArgs
    );
  • Core implementation of single note creation: generates FS-safe filename, validates metadata schema, formats YAML frontmatter, writes .md file, indexes for search.
    async createNote(
      typeName: string,
      title: string,
      content: string,
      metadata: Record<string, unknown> = {}
    ): Promise<NoteInfo> {
      try {
        // Validate inputs
        if (!title || title.trim().length === 0) {
          throw new Error('Note title is required and cannot be empty');
        }
    
        // Trim the title for consistent handling
        const trimmedTitle = title.trim();
    
        // Validate and ensure note type exists
        if (!this.#workspace.isValidNoteTypeName(typeName)) {
          throw new Error(`Invalid note type name: ${typeName}`);
        }
    
        const typePath = await this.#workspace.ensureNoteType(typeName);
    
        // Generate filename from title and check availability
        const baseFilename = this.generateFilename(trimmedTitle);
        await this.checkFilenameAvailability(typePath, baseFilename);
        const filename = baseFilename;
        const notePath = path.join(typePath, filename);
    
        // Prepare metadata with title for validation
        const metadataWithTitle = {
          title: trimmedTitle,
          ...metadata
        };
    
        // Validate metadata against schema
        const validationResult = await this.validateMetadata(typeName, metadataWithTitle);
        if (!validationResult.valid) {
          throw new Error(
            `Metadata validation failed: ${validationResult.errors.map(e => e.message).join(', ')}`
          );
        }
    
        // Prepare note content with metadata
        const noteContent = await this.formatNoteContent(
          trimmedTitle,
          content,
          typeName,
          metadata
        );
    
        // Write the note file
        await fs.writeFile(notePath, noteContent, 'utf-8');
    
        // Update search index
        await this.updateSearchIndex(notePath, noteContent);
    
        return {
          id: this.generateNoteId(typeName, filename),
          type: typeName,
          title: trimmedTitle,
          filename,
          path: notePath,
          created: new Date().toISOString()
        };
      } catch (error) {
        if (error instanceof Error) {
          // Preserve custom error properties if they exist
          const flintError = error as FlintNoteError;
          if (flintError.code === 'NOTE_ALREADY_EXISTS') {
            // Re-throw the original error for duplicate notes to preserve error details
            throw error;
          }
          // For other errors, wrap with context
          throw new Error(`Failed to create note '${title}': ${error.message}`);
        }
        throw new Error(`Failed to create note '${title}': Unknown error`);
      }
    }
  • Batch note creation helper: loops over input array calling createNote, returns summary of successful/failed creations.
    async batchCreateNotes(notes: BatchCreateNoteInput[]): Promise<BatchCreateResult> {
      const results: BatchCreateResult['results'] = [];
      let successful = 0;
      let failed = 0;
    
      for (const noteInput of notes) {
        try {
          const result = await this.createNote(
            noteInput.type,
            noteInput.title,
            noteInput.content,
            noteInput.metadata || {}
          );
          results.push({
            input: noteInput,
            success: true,
            result
          });
          successful++;
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : 'Unknown error';
          results.push({
            input: noteInput,
            success: false,
            error: errorMessage
          });
          failed++;
        }
      }
    
      return {
        total: notes.length,
        successful,
        failed,
        results
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral context. It doesn't disclose permission requirements, whether creation is idempotent, what happens with invalid types/metadata, or how errors are handled. 'Create' implies mutation but lacks safety/constraint details needed for a tool with 6 parameters.

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

Conciseness4/5

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

Single sentence is appropriately concise for a creation tool. However, it's not optimally front-loaded - it could immediately distinguish single vs batch creation patterns. No wasted words, but could be more structured.

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

Completeness2/5

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

For a mutation tool with 6 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain the single vs batch creation dichotomy evident in the schema, doesn't clarify what 'note types' are or how to discover them, and provides no information about return values or error conditions.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 6 parameters. The description adds no parameter-specific information beyond implying 'type' matters and batch creation is possible. Baseline 3 is appropriate when schema does all parameter documentation.

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

Purpose3/5

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

The description states the action ('create') and resource ('notes') but is vague about scope - 'one or more notes of the specified type(s)' doesn't clarify whether this handles single vs batch creation or what 'type' means. It distinguishes from deletion/search siblings but not clearly from other creation tools like create_note_type.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs alternatives like create_note_type or update_note. The description mentions 'specified type(s)' but doesn't explain what types are or when batch vs single creation is appropriate. No prerequisites or exclusions are stated.

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/disnet/flint-note'

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