Skip to main content
Glama

Manage activity types

monica_manage_activity_type

Manage activity types in Monica CRM to customize your activity catalog before logging interactions, supporting list, create, update, and delete operations.

Instructions

List, inspect, create, update, or delete Monica activity types (e.g., Meeting, Coffee, Meal). Use this to expand the catalog with custom activity names before logging activities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
activityTypeIdNo
limitNo
pageNo
payloadNo

Implementation Reference

  • The main handler function for the monica_manage_activity_type tool. Parses input with Zod, then switches on 'action' to perform list, get, create, update, or delete operations on Monica activity types using the client API. Normalizes data, logs actions, and returns structured responses using helper builders.
    async (rawInput) => {
      const input = activityTypeInputSchema.parse(rawInput);
    
      switch (input.action) {
        case 'list': {
          const response = await client.listActivityTypes({ limit: input.limit, page: input.page });
          const activityTypes = response.data.map(normalizeActivityType);
          const summary = generateListSummary({ count: activityTypes.length, itemName: 'activity type' });
    
          return buildListResponse({
            items: activityTypes,
            itemName: 'activity type',
            summaryText: summary,
            structuredData: {
              action: input.action,
              activityTypes
            },
            pagination: extractPagination(response)
          });
        }
    
        case 'get': {
          const typedInput = input as IdInput;
          const response = await client.getActivityType(typedInput.activityTypeId);
          const activityType = normalizeActivityType(response.data);
    
          return buildGetResponse({
            item: activityType,
            summaryText: `Activity type ${activityType.name} (ID ${activityType.id}).`,
            structuredData: {
              action: input.action,
              activityTypeId: typedInput.activityTypeId,
              activityType
            }
          });
        }
    
        case 'create': {
          const typedInput = input as CreateInput;
          const response = await client.createActivityType(toActivityTypePayload(typedInput.payload));
          const activityType = normalizeActivityType(response.data);
          logger.info({ activityTypeId: activityType.id }, 'Created Monica activity type');
    
          return buildMutationResponse({
            action: 'create',
            summaryText: generateCreateSummary({
              itemName: 'activity type',
              itemId: activityType.id,
              itemLabel: activityType.name
            }),
            structuredData: {
              activityType
            }
          });
        }
    
        case 'update': {
          const typedInput = input as UpdateInput;
          const response = await client.updateActivityType(
            typedInput.activityTypeId,
            toActivityTypePayload(typedInput.payload)
          );
          const activityType = normalizeActivityType(response.data);
          logger.info({ activityTypeId: activityType.id }, 'Updated Monica activity type');
    
          return buildMutationResponse({
            action: 'update',
            summaryText: generateUpdateSummary({
              itemName: 'activity type',
              itemId: activityType.id,
              itemLabel: activityType.name
            }),
            structuredData: {
              activityTypeId: activityType.id,
              activityType
            }
          });
        }
    
        case 'delete': {
          const typedInput = input as IdInput;
          await client.deleteActivityType(typedInput.activityTypeId);
          logger.info({ activityTypeId: typedInput.activityTypeId }, 'Deleted Monica activity type');
    
          return buildMutationResponse({
            action: 'delete',
            summaryText: generateDeleteSummary({
              itemName: 'activity type',
              itemId: typedInput.activityTypeId
            }),
            structuredData: {
              activityTypeId: typedInput.activityTypeId,
              deleted: true
            }
          });
        }
    
        default:
          throw new Error(`Unsupported action: ${String((input as ActivityTypeInput).action)}`);
      }
    }
  • Zod schemas for tool input validation: payload schema, input shape with action enum and optional fields, and refined schema with action-specific validation rules.
    const activityTypePayloadSchema = z.object({
      name: z.string().min(1).max(255),
      categoryId: z.number().int().positive(),
      locationType: z.string().max(255).optional().nullable()
    });
    
    type ActivityTypePayload = z.infer<typeof activityTypePayloadSchema>;
    
    const activityTypeInputShape = {
      action: z.enum(['list', 'get', 'create', 'update', 'delete']),
      activityTypeId: z.number().int().positive().optional(),
      limit: z.number().int().min(1).max(100).optional(),
      page: z.number().int().min(1).optional(),
      payload: activityTypePayloadSchema.optional()
    } as const;
    
    const activityTypeInputSchema = z.object(activityTypeInputShape).superRefine((data, ctx) => {
      switch (data.action) {
        case 'list':
          return;
        case 'get':
        case 'delete':
          if (data.activityTypeId == null) {
            ctx.addIssue({
              code: z.ZodIssueCode.custom,
              path: ['activityTypeId'],
              message: 'Provide activityTypeId for this action.'
            });
          }
          return;
        case 'create':
          if (!data.payload) {
            ctx.addIssue({
              code: z.ZodIssueCode.custom,
              path: ['payload'],
              message: 'Provide payload when creating an activity type.'
            });
          }
          return;
        case 'update':
          if (data.activityTypeId == null) {
            ctx.addIssue({
              code: z.ZodIssueCode.custom,
              path: ['activityTypeId'],
              message: 'Provide activityTypeId when updating an activity type.'
            });
          }
          if (!data.payload) {
            ctx.addIssue({
              code: z.ZodIssueCode.custom,
              path: ['payload'],
              message: 'Provide payload when updating an activity type.'
            });
          }
          return;
        default:
          ctx.addIssue({
            code: z.ZodIssueCode.custom,
            message: `Unsupported action: ${String(data.action)}`
          });
      }
    });
  • Registers the 'monica_manage_activity_type' tool using server.registerTool, specifying name, title, description, inputSchema, and inline handler function.
    export function registerActivityTypeTools(context: ToolRegistrationContext): void {
      const { server, client, logger } = context;
    
      server.registerTool(
        'monica_manage_activity_type',
        {
          title: 'Manage activity types',
          description:
            'List, inspect, create, update, or delete Monica activity types (e.g., Meeting, Coffee, Meal). Use this to expand the catalog with custom activity names before logging activities.',
          inputSchema: activityTypeInputShape
        },
        async (rawInput) => {
          const input = activityTypeInputSchema.parse(rawInput);
    
          switch (input.action) {
            case 'list': {
              const response = await client.listActivityTypes({ limit: input.limit, page: input.page });
              const activityTypes = response.data.map(normalizeActivityType);
              const summary = generateListSummary({ count: activityTypes.length, itemName: 'activity type' });
    
              return buildListResponse({
                items: activityTypes,
                itemName: 'activity type',
                summaryText: summary,
                structuredData: {
                  action: input.action,
                  activityTypes
                },
                pagination: extractPagination(response)
              });
            }
    
            case 'get': {
              const typedInput = input as IdInput;
              const response = await client.getActivityType(typedInput.activityTypeId);
              const activityType = normalizeActivityType(response.data);
    
              return buildGetResponse({
                item: activityType,
                summaryText: `Activity type ${activityType.name} (ID ${activityType.id}).`,
                structuredData: {
                  action: input.action,
                  activityTypeId: typedInput.activityTypeId,
                  activityType
                }
              });
            }
    
            case 'create': {
              const typedInput = input as CreateInput;
              const response = await client.createActivityType(toActivityTypePayload(typedInput.payload));
              const activityType = normalizeActivityType(response.data);
              logger.info({ activityTypeId: activityType.id }, 'Created Monica activity type');
    
              return buildMutationResponse({
                action: 'create',
                summaryText: generateCreateSummary({
                  itemName: 'activity type',
                  itemId: activityType.id,
                  itemLabel: activityType.name
                }),
                structuredData: {
                  activityType
                }
              });
            }
    
            case 'update': {
              const typedInput = input as UpdateInput;
              const response = await client.updateActivityType(
                typedInput.activityTypeId,
                toActivityTypePayload(typedInput.payload)
              );
              const activityType = normalizeActivityType(response.data);
              logger.info({ activityTypeId: activityType.id }, 'Updated Monica activity type');
    
              return buildMutationResponse({
                action: 'update',
                summaryText: generateUpdateSummary({
                  itemName: 'activity type',
                  itemId: activityType.id,
                  itemLabel: activityType.name
                }),
                structuredData: {
                  activityTypeId: activityType.id,
                  activityType
                }
              });
            }
    
            case 'delete': {
              const typedInput = input as IdInput;
              await client.deleteActivityType(typedInput.activityTypeId);
              logger.info({ activityTypeId: typedInput.activityTypeId }, 'Deleted Monica activity type');
    
              return buildMutationResponse({
                action: 'delete',
                summaryText: generateDeleteSummary({
                  itemName: 'activity type',
                  itemId: typedInput.activityTypeId
                }),
                structuredData: {
                  activityTypeId: typedInput.activityTypeId,
                  deleted: true
                }
              });
            }
    
            default:
              throw new Error(`Unsupported action: ${String((input as ActivityTypeInput).action)}`);
          }
        }
      );
    }
  • Invokes registerActivityTypeTools as part of the main registerTools function, which sets up all MCP tools.
    registerActivityTypeTools(context);
  • Helper function to transform the input payload into the exact format required by the Monica client's create/updateActivityType methods.
    function toActivityTypePayload(payload: ActivityTypePayload) {
      return {
        name: payload.name,
        categoryId: payload.categoryId,
        locationType: payload.locationType ?? null
      };
    }
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. While it mentions the CRUD operations, it doesn't address important behavioral aspects like authentication requirements, rate limits, whether deletions are permanent, what happens to existing activities when types are modified, or the response format. For a multi-action tool with destructive operations, this leaves significant gaps.

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 perfectly concise with two sentences that each earn their place: the first states the core functionality, the second provides usage context. It's front-loaded with the essential information and contains zero wasted words.

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?

For a complex tool with 5 parameters, nested objects, multiple actions including destructive operations, and no output schema or annotations, the description is insufficient. It doesn't explain the multi-action nature, parameter dependencies, expected responses, or behavioral implications. The context signals indicate high complexity that the description doesn't adequately address.

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?

With 0% schema description coverage, the description doesn't add any parameter-specific information beyond what's implied by the tool's purpose. It doesn't explain what 'action' values mean, when 'activityTypeId' is required, how 'limit' and 'page' work for pagination, or what 'payload' contains for create/update operations. The baseline is 3 since the schema provides structure, but the description fails to compensate for the coverage gap.

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 ('Monica activity types'), plus provides concrete examples ('e.g., Meeting, Coffee, Meal'). It distinguishes this tool from sibling tools like 'monica_manage_activity' by focusing on activity types rather than activities themselves.

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 when to use this tool ('to expand the catalog with custom activity names before logging activities'), which helps guide usage. However, it doesn't explicitly state when NOT to use it or mention specific alternatives among the sibling tools, preventing a perfect score.

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