Skip to main content
Glama

monica_manage_contact_address

Manage contact addresses in Monica CRM by listing, creating, updating, or deleting address records with street, city, postal code, and country details.

Instructions

List, get, create, update, or delete contact addresses. Use this simplified tool instead of monica_manage_contact when managing addresses. Provide contactId and addressPayload with name, street, city, province, postalCode, and countryName (country lookup is automatic).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
contactIdNo
addressIdNo
addressPayloadNo
limitNo
pageNo

Implementation Reference

  • Tool registration for monica_manage_contact_address, including wrapper handler that delegates to core handleContactOperation with section set to 'address'.
    server.registerTool( 'monica_manage_contact_address', { title: 'Manage contact addresses', description: 'List, get, create, update, or delete contact addresses. Use this simplified tool instead of monica_manage_contact when managing addresses. Provide contactId and addressPayload with name, street, city, province, postalCode, and countryName (country lookup is automatic).', inputSchema: addressInputSchema }, async (rawInput) => { const input = z.object(addressInputSchema).parse(rawInput); return handleContactOperation( { section: 'address', action: input.action, contactId: input.contactId, addressId: input.addressId, addressPayload: input.addressPayload, limit: input.limit, page: input.page }, context ); } );
  • Input schema validation for the monica_manage_contact_address tool.
    const addressInputSchema = { action: z.enum(['list', 'get', 'create', 'update', 'delete']), contactId: z.number().int().positive().optional(), addressId: z.number().int().positive().optional(), addressPayload: addressPayloadSchema.optional(), limit: z.number().int().min(1).max(100).optional(), page: z.number().int().min(1).optional() };
  • Schema for addressPayload used in create/update operations.
    const addressPayloadSchema = z.object({ contactId: z.number().int().positive(), name: z.string().min(1).max(255), street: z.string().max(255).optional().nullable(), city: z.string().max(255).optional().nullable(), province: z.string().max(255).optional().nullable(), postalCode: z.string().max(255).optional().nullable(), countryId: z.string().max(3).optional().nullable(), countryIso: z.string().max(3).optional().nullable(), countryName: z.string().max(255).optional().nullable() });
  • Core handler logic for address operations (list, get, create, update, delete) in the shared handleContactOperation function, called by the tool wrapper.
    case 'address': { switch (input.action) { case 'list': { const response = await client.listAddresses({ contactId: input.contactId!, limit: input.limit, page: input.page }); const addresses = response.data.map(normalizeAddress); const summary = addresses.length ? `Fetched ${addresses.length} address${addresses.length === 1 ? '' : 'es'} for contact ${input.contactId}.` : `No addresses found for contact ${input.contactId}.`; return { content: [ { type: 'text' as const, text: summary } ], structuredContent: { section: input.section, action: input.action, contactId: input.contactId, addresses, 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.getAddress(input.addressId!); const address = normalizeAddress(response.data); return { content: [ { type: 'text' as const, text: `Retrieved address "${address.name}" (ID ${address.id}).` } ], structuredContent: { section: input.section, action: input.action, address } }; } case 'create': { const payload = input.addressPayload!; const countryId = await resolveCountryId(client, { countryId: payload.countryId, countryIso: payload.countryIso, countryName: payload.countryName }); const result = await client.createAddress( toAddressPayloadInput({ ...payload, countryId }) ); const address = normalizeAddress(result.data); logger.info({ addressId: address.id, contactId: address.contact.id }, 'Created Monica address'); return { content: [ { type: 'text' as const, text: `Created address "${address.name}" (ID ${address.id}) for contact ${address.contact.id}.` } ], structuredContent: { section: input.section, action: input.action, address } }; } case 'update': { const payload = input.addressPayload!; const countryId = await resolveCountryId(client, { countryId: payload.countryId, countryIso: payload.countryIso, countryName: payload.countryName }); const result = await client.updateAddress( input.addressId!, toAddressPayloadInput({ ...payload, countryId }) ); const address = normalizeAddress(result.data); logger.info({ addressId: input.addressId }, 'Updated Monica address'); return { content: [ { type: 'text' as const, text: `Updated address "${address.name}" (ID ${address.id}).` } ], structuredContent: { section: input.section, action: input.action, addressId: input.addressId, address } }; } case 'delete': { const result = await client.deleteAddress(input.addressId!); logger.info({ addressId: input.addressId }, 'Deleted Monica address'); return { content: [ { type: 'text' as const, text: `Deleted address ID ${input.addressId}.` } ], structuredContent: { section: input.section, action: input.action, addressId: input.addressId, result } }; } default: return unreachable(input.action as never); } }
  • Helper function to transform address payload input for Monica API calls.
    function toAddressPayloadInput( payload: AddressPayloadForm & { countryId: string | null } ): CreateAddressPayload & UpdateAddressPayload { return { contactId: payload.contactId, name: payload.name, street: payload.street ?? null, city: payload.city ?? null, province: payload.province ?? null, postalCode: payload.postalCode ?? null, countryId: payload.countryId }; }

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