Skip to main content
Glama

Log Monica calls

monica_manage_call

Manage logged phone calls in Monica CRM by creating, viewing, updating, or deleting call records to track conversations with contacts.

Instructions

List, inspect, create, update, or delete logged phone calls. Use this to capture quick notes about conversations with contacts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
callIdNo
contactIdNo
limitNo
pageNo
payloadNo

Implementation Reference

  • Registers the 'monica_manage_call' tool using server.registerTool, providing title, description, and input schema.
    server.registerTool(
      'monica_manage_call',
      {
        title: 'Log Monica calls',
        description:
          'List, inspect, create, update, or delete logged phone calls. Use this to capture quick notes about conversations with contacts.',
        inputSchema: {
          action: z.enum(['list', 'get', 'create', 'update', 'delete']),
          callId: 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: callPayloadSchema.optional()
        }
      },
  • The async handler function that implements the core logic for all actions (list, get, create, update, delete) of the monica_manage_call tool, using MonicaClient methods and normalization.
    async ({ action, callId, contactId, limit, page, payload }) => {
      switch (action) {
        case 'list': {
          const response = await client.listCalls({ contactId, limit, page });
          const calls = response.data.map(normalizeCall);
          const scope = contactId ? `contact ${contactId}` : 'your account';
          const textSummary = calls.length
            ? `Found ${calls.length} call${calls.length === 1 ? '' : 's'} for ${scope}.`
            : `No calls found for ${scope}.`;
    
          return {
            content: [
              { type: 'text' as const, text: textSummary }
            ],
            structuredContent: {
              action,
              contactId,
              calls,
              pagination: {
                currentPage: response.meta.current_page,
                lastPage: response.meta.last_page,
                perPage: response.meta.per_page,
                total: response.meta.total
              }
            }
          };
        }
    
        case 'get': {
          if (!callId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide callId when retrieving a call.' }
              ]
            };
          }
    
          const response = await client.getCall(callId);
          const call = normalizeCall(response.data);
          const contactName = call.contact?.name || `Contact ${call.contactId}`;
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Call ${call.id} with ${contactName} on ${call.calledAt ?? 'unknown date'}.`
              }
            ],
            structuredContent: {
              action,
              callId,
              call
            }
          };
        }
    
        case 'create': {
          if (!payload) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide calledAt, contactId, and optional content when logging a call.' }
              ]
            };
          }
    
          let input: CreateCallPayload;
          try {
            input = toCallCreatePayload(payload);
          } catch (error) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: (error as Error).message }
              ]
            };
          }
    
          const response = await client.createCall(input);
          const call = normalizeCall(response.data);
          logger.info({ callId: call.id, contactId: call.contactId }, 'Logged Monica call');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Logged call ${call.id} for contact ${call.contactId}.`
              }
            ],
            structuredContent: {
              action,
              call
            }
          };
        }
    
        case 'update': {
          if (!callId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide callId when updating a call.' }
              ]
            };
          }
    
          if (!payload) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide call details when updating a call.' }
              ]
            };
          }
    
          const patch = toCallUpdatePayload(payload);
          if (patch.calledAt === undefined && patch.contactId === undefined && patch.content === undefined) {
            return {
              isError: true as const,
              content: [
                {
                  type: 'text' as const,
                  text: 'Include at least one field (calledAt, contactId, or content) to update the call.'
                }
              ]
            };
          }
    
          const response = await client.updateCall(callId, patch);
          const call = normalizeCall(response.data);
          logger.info({ callId, contactId: call.contactId }, 'Updated Monica call');
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Updated call ${callId}.`
              }
            ],
            structuredContent: {
              action,
              callId,
              call
            }
          };
        }
    
        case 'delete': {
          if (!callId) {
            return {
              isError: true as const,
              content: [
                { type: 'text' as const, text: 'Provide callId when deleting a call.' }
              ]
            };
          }
    
          const result = await client.deleteCall(callId);
          logger.info({ callId }, 'Deleted Monica call');
    
          return {
            content: [
              { type: 'text' as const, text: `Deleted call ID ${callId}.` }
            ],
            structuredContent: {
              action,
              callId,
              result
            }
          };
        }
    
        default:
          return {
            isError: true as const,
            content: [
              { type: 'text' as const, text: `Unsupported action: ${action}.` }
            ]
          };
      }
    }
  • Zod schema for validating call payload inputs used in create, update actions.
    const callPayloadSchema = z.object({
      calledAt: z
        .string()
        .regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/u, 'calledAt must use YYYY-MM-DD format.')
        .optional(),
      contactId: z.number().int().positive().optional(),
      content: z.string().max(1_000_000).optional().nullable()
    });
    
    type CallPayloadForm = z.infer<typeof callPayloadSchema>;
  • Helper to convert user payload form to CreateCallPayload for the Monica API.
    function toCallCreatePayload(payload: CallPayloadForm): CreateCallPayload {
      if (!payload.calledAt || typeof payload.contactId !== 'number') {
        throw new Error('Provide calledAt and contactId when creating a call.');
      }
    
      return {
        contactId: payload.contactId,
        calledAt: payload.calledAt,
        content: payload.content ?? null
      };
    }
  • Helper to convert partial user payload to UpdateCallPayload, only including provided fields.
    function toCallUpdatePayload(payload: CallPayloadForm): UpdateCallPayload {
      const result: UpdateCallPayload = {};
    
      if (payload.contactId !== undefined) {
        result.contactId = payload.contactId;
      }
    
      if (payload.calledAt !== undefined) {
        result.calledAt = payload.calledAt;
      }
    
      if (payload.content !== undefined) {
        result.content = payload.content ?? null;
      }
    
      return result;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'capture quick notes' which implies creation/update operations, but doesn't clarify permissions needed, whether deletions are permanent, rate limits, or what the response looks like (e.g., format of listed calls). For a multi-action tool with mutations, this is a significant gap in transparency.

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 lists actions and resource, the second provides a use case. It's front-loaded with the core purpose. While efficient, the second sentence could be more informative, but overall it avoids unnecessary verbosity.

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 mutations), no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits, parameter usage, and expected outputs, making it inadequate for an AI agent to reliably invoke this tool without guesswork.

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

Parameters2/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 by explaining parameters. It adds no parameter-specific information beyond implying 'contactId' and 'content' might be used for notes. With 6 parameters (including nested 'payload'), the description fails to clarify the meaning of 'action' enum values, 'callId' usage, or pagination details, leaving most semantics undocumented.

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, inspect, create, update, or delete logged phone calls' specifies multiple verbs and the resource (phone calls). It distinguishes from siblings like 'monica_list_contacts' by focusing on calls rather than contacts, but doesn't explicitly differentiate from 'monica_manage_activity' which might handle similar operations for activities.

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?

The description provides minimal guidance: 'Use this to capture quick notes about conversations with contacts' suggests a use case but doesn't specify when to choose this tool over alternatives like 'monica_manage_activity' for logging interactions, nor does it mention prerequisites or exclusions. No explicit when/when-not or alternative tool references are provided.

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