Skip to content

D2 — Add log_contact_interaction tool #83

@ColdByDefault

Description

@ColdByDefault

Context

The ContactInteraction model already exists in prisma/schema.prisma but there is no tool or API route to write to it. The LLM cannot log interactions like "I called Marcus today" or "sent Lena the one-pager."

What to build

Tool: log_contact_interaction

  • minTier: "free"
  • Parameters: contactId (or contactName for name resolver), type (call / email / meeting / note), note (string), date (ISO string, optional — defaults to now)

Logic: lib/contacts/log-interaction.logic.ts

  • Resolves contact by name if ID not given (via resolvers.ts pattern)
  • Validates ownership
  • Creates ContactInteraction row
  • Updates Contact.lastContact to the interaction date

Tool handler: add to lib/tools/handlers/contacts.handler.ts

Registry: add to lib/tools/registry/contacts.registry.ts

API route: app/api/contacts/[id]/interactions/route.ts (POST + GET)

Acceptance Criteria

  • LLM can log an interaction from "I called Marcus today, he confirmed the pilot"
  • Contact.lastContact is updated automatically
  • Interaction list is retrievable via the API route
  • Contact name resolver works (no need to know the ID)

Metadata

Metadata

Assignees

Labels

enhancementExtending a feature or improvementfeatureNew feature

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions