@telitask/mcp-server 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../src/tools/calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4JzE,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAgF5C;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAwC5C;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAgC5C;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,IAAI,EAA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,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAwE5C;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAgC5C;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAuC5C;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAwC5C;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAyF5C;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6EzD"}
@@ -196,26 +196,54 @@ export async function handleScheduleCall(params) {
196
196
  const userId = getUserId();
197
197
  const voiceServerUrl = getVoiceServerUrl();
198
198
  const accessToken = getAccessToken();
199
- const contactResult = await resolveContact(params.contact_id, params.contact_name);
200
- if (Array.isArray(contactResult))
201
- return contactResult;
202
199
  const personaId = await resolvePersonaId(params.persona_id, userId);
203
200
  if (!personaId) {
204
201
  return [{ type: 'text', text: 'No persona specified and no default persona set. Please provide a persona_id.' }];
205
202
  }
203
+ // Determine if this is a self-call or a contact call
204
+ const isContactCall = !!(params.contact_id || params.contact_name);
205
+ let callType;
206
+ let contactId;
207
+ let targetName;
208
+ if (isContactCall) {
209
+ const contactResult = await resolveContact(params.contact_id, params.contact_name);
210
+ if (Array.isArray(contactResult))
211
+ return contactResult;
212
+ callType = 'on_behalf';
213
+ contactId = contactResult.id;
214
+ targetName = contactResult.full_name;
215
+ }
216
+ else {
217
+ // Self-call: verify user has a phone number
218
+ const supabase = getAuthenticatedClient();
219
+ const { data: userProfile, error } = await supabase
220
+ .from('users')
221
+ .select('phone_number')
222
+ .eq('id', userId)
223
+ .single();
224
+ if (error) {
225
+ return [{ type: 'text', text: `Failed to look up your profile: ${error.message}` }];
226
+ }
227
+ if (!userProfile?.phone_number) {
228
+ return [{ type: 'text', text: 'No phone number on your profile. Please add one in the dashboard settings.' }];
229
+ }
230
+ callType = 'direct';
231
+ targetName = 'you';
232
+ }
233
+ const body = {
234
+ personaId,
235
+ callType,
236
+ purpose: params.brief,
237
+ scheduledAt: params.scheduled_at,
238
+ ...(contactId && { contactId }),
239
+ };
206
240
  const response = await fetch(`${voiceServerUrl}/api/scheduled-calls`, {
207
241
  method: 'POST',
208
242
  headers: {
209
243
  'Content-Type': 'application/json',
210
244
  Authorization: `Bearer ${accessToken}`,
211
245
  },
212
- body: JSON.stringify({
213
- personaId,
214
- callType: 'on_behalf',
215
- contactId: contactResult.id,
216
- purpose: params.brief,
217
- scheduledAt: params.scheduled_at,
218
- }),
246
+ body: JSON.stringify(body),
219
247
  });
220
248
  if (!response.ok) {
221
249
  const errBody = await response.text().catch(() => '');
@@ -224,7 +252,7 @@ export async function handleScheduleCall(params) {
224
252
  const result = await response.json();
225
253
  return [{
226
254
  type: 'text',
227
- text: `Call scheduled to **${contactResult.full_name}** at ${params.scheduled_at}.\nBrief: ${params.brief}\nScheduled call ID: ${result.id ?? 'pending'}`,
255
+ text: `Call scheduled to **${targetName}** at ${params.scheduled_at}.\nBrief: ${params.brief}\nScheduled call ID: ${result.id ?? 'pending'}`,
228
256
  }];
229
257
  }
230
258
  export async function handleCancelCall(params) {
@@ -425,7 +453,7 @@ export function registerCallTools(server) {
425
453
  }, async ({ contact_id, contact_name, brief, persona_id, wait_for_result }) => ({
426
454
  content: await handleMakeCall({ contact_id, contact_name, brief, persona_id, wait_for_result }),
427
455
  }));
428
- server.tool('schedule_call', 'Schedule a phone call for a future time. Resolves contacts by ID or name.', {
456
+ server.tool('schedule_call', 'Schedule a phone call for a future time. If contact_id or contact_name is provided, schedules a call to that contact. If neither is provided, schedules a call to the user\'s own phone number.', {
429
457
  contact_id: z.string().optional().describe('Contact ID to call'),
430
458
  contact_name: z.string().optional().describe('Contact name to search for'),
431
459
  brief: z.string().describe('Purpose/brief for the call'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telitask/mcp-server",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "TeliTask MCP server — manage contacts, tasks, and calls from AI assistants",
5
5
  "type": "module",
6
6
  "license": "MIT",