Skip to content

fix: map MCP field names to Tweek API format for task operations#4

Open
gabdorf wants to merge 2 commits intowaspeer:mainfrom
gabdorf:fix/task-field-mapping
Open

fix: map MCP field names to Tweek API format for task operations#4
gabdorf wants to merge 2 commits intowaspeer:mainfrom
gabdorf:fix/task-field-mapping

Conversation

@gabdorf
Copy link

@gabdorf gabdorf commented Jan 16, 2026

Summary

Task creation and updates were failing because the MCP interface uses different field names than the Tweek API expects. This PR adds mapper functions to translate between the two formats.

Field Name Mappings

MCP Field Tweek API Field
title text
description note
completed done

Changes

src/tweek/mappers.ts

  • Added mapCreateTaskToApi() function to map CreateTaskRequest to API format
  • Added mapTaskPatchToApi() function to map TaskPatch to API format
  • Both functions also map nested checklist items (completeddone)
  • mapCreateTaskToApi() sets required API fields: done (default: false), gcal (false)

src/tweek/tweekClient.ts

  • Updated createTask() to use mapCreateTaskToApi() before sending data
  • Updated updateTask() to use mapTaskPatchToApi() before sending data

Closes #2

Add mapCreateTaskToApi() and mapTaskPatchToApi() functions to properly
map field names between MCP interface and Tweek API:
- title -> text
- description -> note  
- completed -> done

Also ensures required API fields (done, gcal) are set for task creation.

Part of fix for waspeer#2
Use mapCreateTaskToApi() and mapTaskPatchToApi() to properly translate
MCP field names to Tweek API format before sending requests.

Closes waspeer#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task creation and updates fail due to field name mismatch with Tweek API

1 participant