Skip to main content
Glama

Manage contact fields

monica_manage_contact_field

Manage contact fields in Monica CRM by creating, updating, deleting, or retrieving email addresses, phone numbers, and social media handles for specific contacts.

Instructions

List, get, create, update, or delete contact fields like email addresses, phone numbers, social media handles, etc. Use this simplified tool instead of monica_manage_contact when managing contact fields. Provide contactId and fieldPayload with data and contactFieldTypeName (e.g., "Email", "Phone").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
contactIdNo
contactFieldIdNo
fieldPayloadNo
limitNo
pageNo

Implementation Reference

  • Registration of the 'monica_manage_contact_field' tool, including its title, description, input schema, and thin wrapper handler that calls handleContactOperation with section='field'.
    server.registerTool(
      'monica_manage_contact_field',
      {
        title: 'Manage contact fields',
        description:
          'List, get, create, update, or delete contact fields like email addresses, phone numbers, social media handles, etc. Use this simplified tool instead of monica_manage_contact when managing contact fields. Provide contactId and fieldPayload with data and contactFieldTypeName (e.g., "Email", "Phone").',
        inputSchema: fieldInputSchema
      },
      async (rawInput) => {
        const input = z.object(fieldInputSchema).parse(rawInput);
    
        return handleContactOperation(
          {
            section: 'field',
            action: input.action,
            contactId: input.contactId,
            contactFieldId: input.contactFieldId,
            fieldPayload: input.fieldPayload,
            limit: input.limit,
            page: input.page
          },
          context
        );
      }
    );
  • Core handler logic for contact field management (list, get, create, update, delete) executed when section='field' in handleContactOperation, which is called by the tool's wrapper handler.
    case 'field': {
      switch (input.action) {
        case 'list': {
          const response = await client.listContactFields({
            contactId: input.contactId!,
            limit: input.limit,
            page: input.page
          });
          const fields = response.data.map(normalizeContactField);
    
          return {
            content: [
              {
                type: 'text' as const,
                text: fields.length
                  ? `Fetched ${fields.length} contact field${fields.length === 1 ? '' : 's'} for contact ${input.contactId}.`
                  : `No contact fields found for contact ${input.contactId}.`
              }
            ],
            structuredContent: {
              section: input.section,
              action: input.action,
              contactId: input.contactId,
              fields,
              pagination: {
                currentPage: response.meta.current_page,
                lastPage: response.meta.last_page,
                perPage: response.meta.per_page,
                total: response.meta.total
              }
            }
          };
        }
    
        case 'get': {
          const response = await client.getContactField(input.contactFieldId!);
          const field = normalizeContactField(response.data);
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Retrieved contact field ${field.type.name} (ID ${field.id}).`
              }
            ],
            structuredContent: {
              section: input.section,
              action: input.action,
              field
            }
          };
        }
    
        case 'create': {
          const payload = input.fieldPayload!;
          const contactFieldTypeId = await resolveContactFieldTypeId(client, {
            contactFieldTypeId: payload.contactFieldTypeId,
            contactFieldTypeName: payload.contactFieldTypeName
          });
    
          const result = await client.createContactField(
            toContactFieldPayloadInput({ ...payload, contactFieldTypeId })
          );
          const field = normalizeContactField(result.data);
          logger.info({ contactFieldId: field.id, contactId: field.contactId }, 'Created Monica contact field');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Created contact field ${field.type.name} (ID ${field.id}) for contact ${field.contactId}.`
              }
            ],
            structuredContent: {
              section: input.section,
              action: input.action,
              field
            }
          };
        }
    
        case 'update': {
          const payload = input.fieldPayload!;
          const contactFieldTypeId = await resolveContactFieldTypeId(client, {
            contactFieldTypeId: payload.contactFieldTypeId,
            contactFieldTypeName: payload.contactFieldTypeName
          });
    
          const result = await client.updateContactField(
            input.contactFieldId!,
            toContactFieldPayloadInput({ ...payload, contactFieldTypeId })
          );
          const field = normalizeContactField(result.data);
          logger.info({ contactFieldId: input.contactFieldId }, 'Updated Monica contact field');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Updated contact field ${field.type.name} (ID ${field.id}).`
              }
            ],
            structuredContent: {
              section: input.section,
              action: input.action,
              contactFieldId: input.contactFieldId,
              field
            }
          };
        }
    
        case 'delete': {
          const result = await client.deleteContactField(input.contactFieldId!);
          logger.info({ contactFieldId: input.contactFieldId }, 'Deleted Monica contact field');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Deleted contact field ID ${input.contactFieldId}.`
              }
            ],
            structuredContent: {
              section: input.section,
              action: input.action,
              contactFieldId: input.contactFieldId,
              result
            }
          };
        }
    
        default:
          return unreachable(input.action as never);
      }
    }
  • Zod schema for contact field payload, used in create and update operations, with validation requiring either contactFieldTypeId or contactFieldTypeName.
    const contactFieldPayloadSchema = z
      .object({
        contactId: z.number().int().positive(),
        contactFieldTypeId: z.number().int().positive().optional(),
        contactFieldTypeName: z.string().min(1).max(255).optional(),
        data: z.string().min(1).max(255)
      })
      .superRefine((data, ctx) => {
        if (typeof data.contactFieldTypeId !== 'number' && !data.contactFieldTypeName) {
          ctx.addIssue({
            code: z.ZodIssueCode.custom,
            message: 'Provide contactFieldTypeId or contactFieldTypeName.'
          });
        }
      });
  • Input schema for the monica_manage_contact_field tool, defining parameters like action, contactId, contactFieldId, fieldPayload, etc.
    const fieldInputSchema = {
      action: z.enum(['list', 'get', 'create', 'update', 'delete']),
      contactId: z.number().int().positive().optional(),
      contactFieldId: z.number().int().positive().optional(),
      fieldPayload: contactFieldPayloadSchema.optional(),
      limit: z.number().int().min(1).max(100).optional(),
      page: z.number().int().min(1).optional()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the CRUD actions but lacks critical behavioral details: it doesn't specify permissions required, whether deletions are permanent, rate limits, error handling, or what the tool returns. For a multi-action tool with no annotation coverage, this leaves significant gaps in understanding how the tool behaves beyond basic functionality.

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?

The description is appropriately sized with two sentences. The first sentence clearly states the purpose and scope, while the second provides usage guidance and parameter hints. There's minimal redundancy, and information is front-loaded effectively. It could be slightly more structured by separating parameter guidance into a distinct section, but overall it's efficient.

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 with nested objects, multiple actions including destructive operations like delete), no annotations, and no output schema, the description is inadequate. It doesn't explain return values, error conditions, authentication needs, or the full behavioral implications of different actions. For a multi-operation tool with significant parameter complexity, this leaves too many unknowns for effective agent use.

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 mentions 'contactId and fieldPayload with data and contactFieldTypeName (e.g., "Email", "Phone")', which adds some semantic context for 3 parameters. However, it doesn't explain the 'action' enum values, 'contactFieldId', 'limit', or 'page' parameters, nor does it clarify the relationship between 'contactFieldTypeId' and 'contactFieldTypeName' in the nested object. The description adds partial value but doesn't fully compensate for the schema coverage gap.

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

Purpose4/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: 'List, get, create, update, or delete contact fields like email addresses, phone numbers, social media handles, etc.' It specifies the verb (manage) and resource (contact fields) with concrete examples. However, it doesn't explicitly differentiate from sibling tools beyond mentioning 'monica_manage_contact' as an alternative for field management, missing comparisons with other field-related tools like 'monica_manage_contact_field_type'.

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 explicit guidance: 'Use this simplified tool instead of monica_manage_contact when managing contact fields.' This clearly indicates when to use this tool versus a specific alternative. However, it doesn't mention when NOT to use it (e.g., for other contact aspects) or compare it to other field-related siblings like 'monica_manage_contact_field_type', leaving some contextual gaps.

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