Skip to main content
Glama

Manage Monica notes

monica_manage_note

Manage notes for contacts in Monica CRM by listing, viewing, creating, updating, or deleting journal entries and snippets attached to contact profiles.

Instructions

List, inspect, create, update, or delete notes attached to a contact. Use this to capture or revise journal snippets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
noteIdNo
contactIdNo
limitNo
pageNo
payloadNo

Implementation Reference

  • Core handler implementing CRUD operations for Monica notes: list notes for contact, get note, create/update/delete note with validation and structured responses.
    async ({ action, noteId, contactId, limit, page, payload }) => {
      if (action === 'list') {
        if (!contactId) {
          return {
            isError: true as const,
            content: [
              { type: 'text' as const, text: 'Provide contactId when listing notes.' }
            ]
          };
        }
    
        const response = await client.fetchContactNotes(contactId, limit, page);
        const notes = response.data.map(normalizeNote);
    
        const summary = notes.length
          ? `Fetched ${notes.length} note${notes.length === 1 ? '' : 's'} for contact ${contactId}.`
          : `No notes found for contact ${contactId}.`;
    
        return {
          content: [
            {
              type: 'text' as const,
              text: summary
            }
          ],
          structuredContent: {
            action,
            contactId,
            notes,
            pagination: {
              currentPage: response.meta.current_page,
              lastPage: response.meta.last_page,
              perPage: response.meta.per_page,
              total: response.meta.total
            }
          }
        };
      }
    
      if (action === 'get') {
        if (!noteId) {
          return {
            isError: true as const,
            content: [
              { type: 'text' as const, text: 'Provide noteId when retrieving a note.' }
            ]
          };
        }
    
        const response = await client.getNote(noteId);
        const note = normalizeNote(response.data);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: `Note ${note.id} for contact ${note.contact.name}.`
            }
          ],
          structuredContent: {
            action,
            note
          }
        };
      }
    
      if (action === 'create') {
        if (!payload || typeof payload.contactId !== 'number' || !payload.body) {
          return {
            isError: true as const,
            content: [
              {
                type: 'text' as const,
                text: 'Provide contactId and body when creating a note.'
              }
            ]
          };
        }
    
        const result = await client.createNote(toNoteCreatePayload(payload));
        const note = normalizeNote(result.data);
        logger.info({ noteId: note.id }, 'Created Monica note');
    
        return {
          content: [
            {
              type: 'text' as const,
              text: `Created note ${note.id} for contact ${note.contact.name}.`
            }
          ],
          structuredContent: {
            action,
            note
          }
        };
      }
    
      if (action === 'update') {
        if (!noteId) {
          return {
            isError: true as const,
            content: [
              { type: 'text' as const, text: 'Provide noteId when updating a note.' }
            ]
          };
        }
    
        if (!payload) {
          return {
            isError: true as const,
            content: [
              { type: 'text' as const, text: 'Provide note details when updating a note.' }
            ]
          };
        }
    
        const result = await client.updateNote(noteId, toNoteUpdatePayload(payload));
        const note = normalizeNote(result.data);
        logger.info({ noteId }, 'Updated Monica note');
    
        return {
          content: [
            {
              type: 'text' as const,
              text: `Updated note ${note.id} for contact ${note.contact.name}.`
            }
          ],
          structuredContent: {
            action,
            noteId,
            note
          }
        };
      }
    
      if (action === 'delete') {
        if (!noteId) {
          return {
            isError: true as const,
            content: [
              { type: 'text' as const, text: 'Provide noteId when deleting a note.' }
            ]
          };
        }
    
        await client.deleteNote(noteId);
        logger.info({ noteId }, 'Deleted Monica note');
    
        return {
          content: [
            {
              type: 'text' as const,
              text: `Deleted note ID ${noteId}.`
            }
          ],
          structuredContent: {
            action,
            noteId,
            deleted: true
          }
        };
      }
    
      return {
        isError: true as const,
        content: [
          {
            type: 'text' as const,
            text: `Unsupported action: ${action}.`
          }
        ]
      };
    }
  • Zod schemas defining input validation for tool parameters including action types and optional note payload.
    const notePayloadSchema = z.object({
      body: z.string().max(1_000_000).optional(),
      contactId: z.number().int().positive().optional(),
      isFavorited: z.boolean().optional()
    });
    
    type NotePayloadForm = z.infer<typeof notePayloadSchema>;
    
    export function registerNoteTools(context: ToolRegistrationContext): void {
      const { server, client, logger } = context;
    
      server.registerTool(
        'monica_manage_note',
        {
          title: 'Manage Monica notes',
          description:
            'List, inspect, create, update, or delete notes attached to a contact. Use this to capture or revise journal snippets.',
          inputSchema: {
            action: z.enum(['list', 'get', 'create', 'update', 'delete']),
            noteId: z.number().int().positive().optional(),
            contactId: z.number().int().positive().optional(),
            limit: z.number().int().min(1).max(100).optional(),
            page: z.number().int().min(1).optional(),
            payload: notePayloadSchema.optional()
          }
  • Direct registration of the 'monica_manage_note' tool via server.registerTool within registerNoteTools function.
    server.registerTool(
      'monica_manage_note',
      {
        title: 'Manage Monica notes',
        description:
          'List, inspect, create, update, or delete notes attached to a contact. Use this to capture or revise journal snippets.',
        inputSchema: {
          action: z.enum(['list', 'get', 'create', 'update', 'delete']),
          noteId: z.number().int().positive().optional(),
          contactId: z.number().int().positive().optional(),
          limit: z.number().int().min(1).max(100).optional(),
          page: z.number().int().min(1).optional(),
          payload: notePayloadSchema.optional()
        }
      },
      async ({ action, noteId, contactId, limit, page, payload }) => {
        if (action === 'list') {
          if (!contactId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide contactId when listing notes.' }
              ]
            };
          }
    
          const response = await client.fetchContactNotes(contactId, limit, page);
          const notes = response.data.map(normalizeNote);
    
          const summary = notes.length
            ? `Fetched ${notes.length} note${notes.length === 1 ? '' : 's'} for contact ${contactId}.`
            : `No notes found for contact ${contactId}.`;
    
          return {
            content: [
              {
                type: 'text' as const,
                text: summary
              }
            ],
            structuredContent: {
              action,
              contactId,
              notes,
              pagination: {
                currentPage: response.meta.current_page,
                lastPage: response.meta.last_page,
                perPage: response.meta.per_page,
                total: response.meta.total
              }
            }
          };
        }
    
        if (action === 'get') {
          if (!noteId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide noteId when retrieving a note.' }
              ]
            };
          }
    
          const response = await client.getNote(noteId);
          const note = normalizeNote(response.data);
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Note ${note.id} for contact ${note.contact.name}.`
              }
            ],
            structuredContent: {
              action,
              note
            }
          };
        }
    
        if (action === 'create') {
          if (!payload || typeof payload.contactId !== 'number' || !payload.body) {
            return {
              isError: true as const,
              content: [
                {
                  type: 'text' as const,
                  text: 'Provide contactId and body when creating a note.'
                }
              ]
            };
          }
    
          const result = await client.createNote(toNoteCreatePayload(payload));
          const note = normalizeNote(result.data);
          logger.info({ noteId: note.id }, 'Created Monica note');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Created note ${note.id} for contact ${note.contact.name}.`
              }
            ],
            structuredContent: {
              action,
              note
            }
          };
        }
    
        if (action === 'update') {
          if (!noteId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide noteId when updating a note.' }
              ]
            };
          }
    
          if (!payload) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide note details when updating a note.' }
              ]
            };
          }
    
          const result = await client.updateNote(noteId, toNoteUpdatePayload(payload));
          const note = normalizeNote(result.data);
          logger.info({ noteId }, 'Updated Monica note');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Updated note ${note.id} for contact ${note.contact.name}.`
              }
            ],
            structuredContent: {
              action,
              noteId,
              note
            }
          };
        }
    
        if (action === 'delete') {
          if (!noteId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide noteId when deleting a note.' }
              ]
            };
          }
    
          await client.deleteNote(noteId);
          logger.info({ noteId }, 'Deleted Monica note');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Deleted note ID ${noteId}.`
              }
            ],
            structuredContent: {
              action,
              noteId,
              deleted: true
            }
          };
        }
    
        return {
          isError: true as const,
          content: [
            {
              type: 'text' as const,
              text: `Unsupported action: ${action}.`
            }
          ]
        };
      }
    );
  • Invocation of registerNoteTools as part of the overall tool registration sequence in registerTools.
    registerNoteTools(context);
  • Helper function to normalize raw Monica API note data to a consistent structured format, used in handler responses.
    export function normalizeNote(note: MonicaNote) {
      return {
        id: note.id,
        body: note.body,
        isFavorited: note.is_favorited,
        favoritedAt: note.favorited_at ?? undefined,
        contactId: note.contact.id,
        contact: normalizeContactSummary(note.contact),
        createdAt: note.created_at,
        updatedAt: note.updated_at
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions actions like 'create, update, or delete' which imply mutations, but does not disclose permissions needed, rate limits, error handling, or what happens on deletion (e.g., irreversible). For a multi-action tool with potential destructive operations, this is a significant gap.

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

Conciseness5/5

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

The description is appropriately sized and front-loaded, with two concise sentences that directly state the tool's purpose and usage. Every sentence earns its place without redundancy or unnecessary details.

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?

Given the tool's complexity (6 parameters, nested objects, multiple actions including destructive ones) and lack of annotations and output schema, the description is incomplete. It does not cover behavioral aspects like safety, return values, or parameter dependencies, leaving significant gaps for an AI agent to use it correctly.

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 0%, so the description must compensate. It does not explain any parameters, such as the meaning of 'action' enum values, when 'noteId' or 'contactId' are required, or what 'payload' contains. The description adds no parameter semantics beyond what the schema provides, but the schema itself is detailed with enums and constraints, providing a baseline.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('list, inspect, create, update, or delete') and resource ('notes attached to a contact'), and distinguishes it from siblings by focusing on notes rather than contacts, activities, or other entities. The phrase 'capture or revise journal snippets' adds useful context about the nature of notes.

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

Usage Guidelines4/5

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

The description provides clear context for usage ('to capture or revise journal snippets'), but does not explicitly state when to use this tool versus alternatives like sibling tools for managing contacts or activities. It implies usage for note-related operations without specifying exclusions or comparisons.

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/Jacob-Stokes/monica-mcp'

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