Skip to main content
Glama

monica_manage_tag

Manage tags in Monica CRM to group and categorize contacts. Perform actions like listing, creating, updating, or deleting tags to organize contact data efficiently.

Instructions

List, inspect, create, update, or delete tags. Tags allow you to group and categorize contacts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
limitNo
pageNo
payloadNo
tagIdNo

Implementation Reference

  • The handler function that executes the tool logic for 'monica_manage_tag'. It uses a switch statement to handle actions: list, get, create, update, or delete tags via MonicaClient methods.
    async ({ action, tagId, payload, limit, page }) => { switch (action) { case 'list': { const result = await client.listTags(limit, page); const tags = result.data.map(normalizeTag); return { content: [ { type: 'text' as const, text: `Found ${result.meta.total} tags:\n${tags.map((tag) => `• ${tag.name} (ID: ${tag.id})`).join('\n')}` } ] }; } case 'get': { if (!tagId) { throw new Error('tagId is required for get action'); } const result = await client.getTag(tagId); const tag = normalizeTag(result.data); return { content: [ { type: 'text' as const, text: `Tag Details:\n• Name: ${tag.name}\n• Slug: ${tag.nameSlug}\n• Created: ${tag.createdAt}\n• Updated: ${tag.updatedAt}` } ] }; } case 'create': { if (!payload) { throw new Error('payload is required for create action'); } const input = toTagPayloadInput(payload); const result = await client.createTag(input); const tag = normalizeTag(result.data); return { content: [ { type: 'text' as const, text: `Created tag "${tag.name}" (ID: ${tag.id})` } ] }; } case 'update': { if (!tagId) { throw new Error('tagId is required for update action'); } if (!payload) { throw new Error('payload is required for update action'); } const input = toTagPayloadInput(payload); const result = await client.updateTag(tagId, input); const tag = normalizeTag(result.data); return { content: [ { type: 'text' as const, text: `Updated tag "${tag.name}" (ID: ${tag.id})` } ] }; } case 'delete': { if (!tagId) { throw new Error('tagId is required for delete action'); } await client.deleteTag(tagId); return { content: [ { type: 'text' as const, text: `Deleted tag with ID ${tagId}` } ] }; } default: throw new Error(`Unknown action: ${action}`); } }
  • The server.registerTool call that registers the 'monica_manage_tag' tool, including its title, description, input schema, and handler reference.
    server.registerTool( 'monica_manage_tag', { title: 'Manage Monica tags', description: 'List, inspect, create, update, or delete tags. Tags allow you to group and categorize contacts.', inputSchema: { action: z.enum(['list', 'get', 'create', 'update', 'delete']), tagId: z.number().int().positive().optional(), limit: z.number().int().min(1).max(100).optional(), page: z.number().int().min(1).optional(), payload: tagPayloadSchema.optional() } }, async ({ action, tagId, payload, limit, page }) => { switch (action) { case 'list': { const result = await client.listTags(limit, page); const tags = result.data.map(normalizeTag); return { content: [ { type: 'text' as const, text: `Found ${result.meta.total} tags:\n${tags.map((tag) => `• ${tag.name} (ID: ${tag.id})`).join('\n')}` } ] }; } case 'get': { if (!tagId) { throw new Error('tagId is required for get action'); } const result = await client.getTag(tagId); const tag = normalizeTag(result.data); return { content: [ { type: 'text' as const, text: `Tag Details:\n• Name: ${tag.name}\n• Slug: ${tag.nameSlug}\n• Created: ${tag.createdAt}\n• Updated: ${tag.updatedAt}` } ] }; } case 'create': { if (!payload) { throw new Error('payload is required for create action'); } const input = toTagPayloadInput(payload); const result = await client.createTag(input); const tag = normalizeTag(result.data); return { content: [ { type: 'text' as const, text: `Created tag "${tag.name}" (ID: ${tag.id})` } ] }; } case 'update': { if (!tagId) { throw new Error('tagId is required for update action'); } if (!payload) { throw new Error('payload is required for update action'); } const input = toTagPayloadInput(payload); const result = await client.updateTag(tagId, input); const tag = normalizeTag(result.data); return { content: [ { type: 'text' as const, text: `Updated tag "${tag.name}" (ID: ${tag.id})` } ] }; } case 'delete': { if (!tagId) { throw new Error('tagId is required for delete action'); } await client.deleteTag(tagId); return { content: [ { type: 'text' as const, text: `Deleted tag with ID ${tagId}` } ] }; } default: throw new Error(`Unknown action: ${action}`); } } );
  • Zod schema for tag payload used in create/update actions (name field).
    const tagPayloadSchema = z.object({ name: z.string().min(1).max(255) });
  • Helper function to convert the input payload form to the format expected by MonicaClient for create/update tag operations.
    function toTagPayloadInput(payload: TagPayloadForm): CreateTagPayload & UpdateTagPayload { return { name: payload.name }; }
  • Call to registerTagTools within the main registerTools function, which ultimately registers the monica_manage_tag tool.
    registerTagTools(context);

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