nixflex-mcp 0.5.0 → 0.5.2
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.
- package/{KIT-EXAMPLES-K7.md → CALL-EXAMPLES.md} +2 -2
- package/CALL-REQUESTS.md +3 -5
- package/CHANGELOG.md +31 -27
- package/{B57-DELETES.md → DELETING-CONTENT.md} +2 -4
- package/LICENSE +9 -9
- package/METHODS.md +8 -8
- package/{KIT-EXAMPLES-K6.md → NUMBER-EXAMPLES.md} +118 -118
- package/NUMBER-FEATURES.md +3 -5
- package/ORGANISATIONS.md +3 -3
- package/README.md +15 -29
- package/agent-reads.js +26 -26
- package/agent-schema.js +24 -24
- package/booking-schemas.js +1 -0
- package/c6-output.js +32 -32
- package/c6-tools.js +35 -35
- package/call-reads.js +43 -43
- package/call-tools.js +22 -22
- package/campaign-schema.js +38 -38
- package/core-tools.js +36 -36
- package/foundation/connection.mjs +48 -48
- package/foundation/launch.mjs +39 -39
- package/foundation/origin-fence.mjs +21 -21
- package/foundation/origins.mjs +15 -15
- package/index.js +165 -165
- package/k6-private.js +36 -36
- package/k6-schemas.js +27 -27
- package/k6-tools.js +42 -42
- package/k7-call.js +34 -34
- package/k7-errors.js +16 -16
- package/k7-schemas.js +34 -34
- package/k7-tools.js +20 -20
- package/k9-deletes.js +90 -90
- package/kit-request.js +24 -24
- package/knowledge-request.js +24 -24
- package/number-reads.js +23 -23
- package/number-schema.js +26 -26
- package/number-usage.js +13 -13
- package/organisation-tools.js +26 -26
- package/package.json +6 -4
- package/safe-tools.js +36 -36
package/agent-reads.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// GET-only adapter: the installed SDK drops status/search. Mutations stay on the SDK.
|
|
2
|
-
import * as z from 'zod/v4';
|
|
3
|
-
import { NixflexConnectionError, errorFromResponse } from 'nixflex';
|
|
4
|
-
export const agentListSchema = z.object({
|
|
5
|
-
limit: z.number().int().min(1).max(200).optional(),
|
|
6
|
-
offset: z.number().int().min(0).max(1000000).optional(),
|
|
7
|
-
status: z.enum(['active','disabled','all']).optional().describe('Default active; all includes disabled.'),
|
|
8
|
-
search: z.string().max(200).regex(/^[^\u0000-\u001f\u007f]*$/).optional().describe('Literal case-insensitive name or ID substring.')
|
|
9
|
-
});
|
|
10
|
-
export function agentReads(apiKey, baseUrl = 'https://api.nixflex.com', fetcher = fetch) {
|
|
11
|
-
return async function read(args = {}) {
|
|
12
|
-
const values = agentListSchema.parse(args);
|
|
13
|
-
const url = new URL(baseUrl.replace(/\/+$/, '') + '/v1/agents');
|
|
14
|
-
for (const [key, value] of Object.entries(values)) if (value !== undefined) url.searchParams.set(key, String(value));
|
|
15
|
-
let response, body;
|
|
16
|
-
try {
|
|
17
|
-
response = await fetcher(url.toString(), { method: 'GET', redirect: 'error', signal: AbortSignal.timeout(30000),
|
|
18
|
-
headers: { Authorization: 'Bearer ' + apiKey, Accept: 'application/json' } });
|
|
19
|
-
} catch { throw new NixflexConnectionError('Could not read agents.'); }
|
|
20
|
-
try { body = await response.json(); } catch { throw new NixflexConnectionError('Invalid agent list response.'); }
|
|
21
|
-
if (!response.ok) throw errorFromResponse(response.status, body, response.headers.get('x-railway-request-id') || undefined,
|
|
22
|
-
Number(response.headers.get('retry-after')) || undefined);
|
|
23
|
-
if (!Array.isArray(body)) throw new NixflexConnectionError('Invalid agent list response.');
|
|
24
|
-
return body;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
1
|
+
// GET-only adapter: the installed SDK drops status/search. Mutations stay on the SDK.
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
|
+
import { NixflexConnectionError, errorFromResponse } from 'nixflex';
|
|
4
|
+
export const agentListSchema = z.object({
|
|
5
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
6
|
+
offset: z.number().int().min(0).max(1000000).optional(),
|
|
7
|
+
status: z.enum(['active','disabled','all']).optional().describe('Default active; all includes disabled.'),
|
|
8
|
+
search: z.string().max(200).regex(/^[^\u0000-\u001f\u007f]*$/).optional().describe('Literal case-insensitive name or ID substring.')
|
|
9
|
+
});
|
|
10
|
+
export function agentReads(apiKey, baseUrl = 'https://api.nixflex.com', fetcher = fetch) {
|
|
11
|
+
return async function read(args = {}) {
|
|
12
|
+
const values = agentListSchema.parse(args);
|
|
13
|
+
const url = new URL(baseUrl.replace(/\/+$/, '') + '/v1/agents');
|
|
14
|
+
for (const [key, value] of Object.entries(values)) if (value !== undefined) url.searchParams.set(key, String(value));
|
|
15
|
+
let response, body;
|
|
16
|
+
try {
|
|
17
|
+
response = await fetcher(url.toString(), { method: 'GET', redirect: 'error', signal: AbortSignal.timeout(30000),
|
|
18
|
+
headers: { Authorization: 'Bearer ' + apiKey, Accept: 'application/json' } });
|
|
19
|
+
} catch { throw new NixflexConnectionError('Could not read agents.'); }
|
|
20
|
+
try { body = await response.json(); } catch { throw new NixflexConnectionError('Invalid agent list response.'); }
|
|
21
|
+
if (!response.ok) throw errorFromResponse(response.status, body, response.headers.get('x-railway-request-id') || undefined,
|
|
22
|
+
Number(response.headers.get('retry-after')) || undefined);
|
|
23
|
+
if (!Array.isArray(body)) throw new NixflexConnectionError('Invalid agent list response.');
|
|
24
|
+
return body;
|
|
25
|
+
};
|
|
26
|
+
}
|
package/agent-schema.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
// Do not strip unknown keys: the engine must return its mixed-key warnings.
|
|
3
|
-
const shape = {};
|
|
4
|
-
for (const key of 'name system_prompt welcome_message language timezone llm_model fallback_message post_call_sms_template'.split(' ')) shape[key] = z.string().optional();
|
|
5
|
-
for (const key of 'voice_id voice_key webhook_url phone_number transfer_number transfer_whisper boosted_keywords voicemail_message'.split(' ')) shape[key] = z.string().nullable().optional();
|
|
6
|
-
for (const key of 'is_active ai_speaks_first dynamic_greeting func_end_call func_cold_transfer func_send_sms record_call post_call_sms_enabled incall_sms_enabled amd_enabled greet_by_name remember_callers require_booking_confirmation voicemail_leave_enabled'.split(' ')) shape[key] = z.boolean().optional();
|
|
7
|
-
shape.temperature = z.number().min(0).max(0.7).optional();
|
|
8
|
-
shape.response_eagerness = z.number().int().min(0).max(1000).optional();
|
|
9
|
-
shape.stt_confidence = z.number().min(0).max(1).optional();
|
|
10
|
-
shape.stt_max_silence_ms = z.number().int().min(0).max(2147483647).optional();
|
|
11
|
-
shape.interruption_sensitivity = z.number().int().min(0).max(100).optional();
|
|
12
|
-
for (const key of ['max_call_duration_seconds', 'silence_hangup_seconds']) shape[key] = z.number().int().min(1).max(2147483).nullable().optional();
|
|
13
|
-
shape.wait_tag_seconds = z.number().int().min(30).max(120).nullable().optional();
|
|
14
|
-
shape.ivr_timeout_seconds = z.number().int().min(1).max(1800).optional();
|
|
15
|
-
shape.speaking_rate = z.union([z.number(), z.null(), z.literal('')]).optional();
|
|
16
|
-
shape.voice_speed = z.number().min(0.01).max(100).optional();
|
|
17
|
-
shape.pickup_delay = z.unknown().optional().describe('Legacy setting, unchanged in this release.');
|
|
18
|
-
shape.dtmf_enabled = z.boolean().nullable().optional();
|
|
19
|
-
shape.recording_source = z.string().nullable().optional().describe('provider/nixflex, case-normalized by the existing engine parser; null/empty clears to provider.');
|
|
20
|
-
shape.response_length = z.enum(['short', 'medium', 'long']).optional();
|
|
21
|
-
shape.transfer_type = z.enum(['cold', 'warm']).optional();
|
|
22
|
-
shape.data_extraction_fields = z.array(z.object({ name: z.string(), type: z.enum(['text', 'selector', 'boolean', 'number']), description: z.string().optional(), optional: z.boolean().optional(), format_example: z.string().optional(), choices: z.array(z.string()).optional() }).passthrough()).max(50).optional();
|
|
23
|
-
export const agentCreateFields = z.object(shape).passthrough().describe('Agent settings: temperature 0..0.7, SMS, voicemail, STT and extraction. Retention inherits the account default. The engine validates all values.');
|
|
24
|
-
export const agentUpdateFields = agentCreateFields.extend({ call_retention_days: z.union([z.literal(90), z.literal(30), z.literal(7), z.literal(1), z.literal(0)]).optional() });
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
// Do not strip unknown keys: the engine must return its mixed-key warnings.
|
|
3
|
+
const shape = {};
|
|
4
|
+
for (const key of 'name system_prompt welcome_message language timezone llm_model fallback_message post_call_sms_template'.split(' ')) shape[key] = z.string().optional();
|
|
5
|
+
for (const key of 'voice_id voice_key webhook_url phone_number transfer_number transfer_whisper boosted_keywords voicemail_message'.split(' ')) shape[key] = z.string().nullable().optional();
|
|
6
|
+
for (const key of 'is_active ai_speaks_first dynamic_greeting func_end_call func_cold_transfer func_send_sms record_call post_call_sms_enabled incall_sms_enabled amd_enabled greet_by_name remember_callers require_booking_confirmation voicemail_leave_enabled'.split(' ')) shape[key] = z.boolean().optional();
|
|
7
|
+
shape.temperature = z.number().min(0).max(0.7).optional();
|
|
8
|
+
shape.response_eagerness = z.number().int().min(0).max(1000).optional();
|
|
9
|
+
shape.stt_confidence = z.number().min(0).max(1).optional();
|
|
10
|
+
shape.stt_max_silence_ms = z.number().int().min(0).max(2147483647).optional();
|
|
11
|
+
shape.interruption_sensitivity = z.number().int().min(0).max(100).optional();
|
|
12
|
+
for (const key of ['max_call_duration_seconds', 'silence_hangup_seconds']) shape[key] = z.number().int().min(1).max(2147483).nullable().optional();
|
|
13
|
+
shape.wait_tag_seconds = z.number().int().min(30).max(120).nullable().optional();
|
|
14
|
+
shape.ivr_timeout_seconds = z.number().int().min(1).max(1800).optional();
|
|
15
|
+
shape.speaking_rate = z.union([z.number(), z.null(), z.literal('')]).optional();
|
|
16
|
+
shape.voice_speed = z.number().min(0.01).max(100).optional();
|
|
17
|
+
shape.pickup_delay = z.unknown().optional().describe('Legacy setting, unchanged in this release.');
|
|
18
|
+
shape.dtmf_enabled = z.boolean().nullable().optional();
|
|
19
|
+
shape.recording_source = z.string().nullable().optional().describe('provider/nixflex, case-normalized by the existing engine parser; null/empty clears to provider.');
|
|
20
|
+
shape.response_length = z.enum(['short', 'medium', 'long']).optional();
|
|
21
|
+
shape.transfer_type = z.enum(['cold', 'warm']).optional();
|
|
22
|
+
shape.data_extraction_fields = z.array(z.object({ name: z.string(), type: z.enum(['text', 'selector', 'boolean', 'number']), description: z.string().optional(), optional: z.boolean().optional(), format_example: z.string().optional(), choices: z.array(z.string()).optional() }).passthrough()).max(50).optional();
|
|
23
|
+
export const agentCreateFields = z.object(shape).passthrough().describe('Agent settings: temperature 0..0.7, SMS, voicemail, STT and extraction. Retention inherits the account default. The engine validates all values.');
|
|
24
|
+
export const agentUpdateFields = agentCreateFields.extend({ call_retention_days: z.union([z.literal(90), z.literal(30), z.literal(7), z.literal(1), z.literal(0)]).optional() });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bookingSchema, callCompletedBookingSchema, smsBookingSchema } from './k6-schemas.js';
|
package/c6-output.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const allowed = new Set(['ok','phone_number','agent_id','provider','is_active','deleted','web_calls_enabled',
|
|
2
|
-
'id','name','functions','method','timeout_ms','has_headers','is_set','api_key_set','webhook_url_set',
|
|
3
|
-
'post_call_url_set','in_call_url_set','pit_set','username','event_slug','default_timezone','location_id','tags','tool_name']);
|
|
4
|
-
export function integrationOutput(value) {
|
|
5
|
-
if (Array.isArray(value)) return value.map(integrationOutput);
|
|
6
|
-
if (!value || typeof value !== 'object') return value;
|
|
7
|
-
const result = { private_fields_omitted: true };
|
|
8
|
-
for (const [key, item] of Object.entries(value)) {
|
|
9
|
-
if (/(?:^|_)url(?:_2)?$/.test(key)) result[key] = item == null ? null : '[omitted: private URL]';
|
|
10
|
-
else if (allowed.has(key)) result[key] = integrationOutput(item);
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
const codes = new Set(['invalid_filter','not_found','server_error','organisation_disabled','organisation_unavailable',
|
|
15
|
-
'unauthorized','invalid_api_key','forbidden','rate_limit_exceeded','owner_required','outcome_unknown','invalid_business_name']);
|
|
16
|
-
export function privateError(error) {
|
|
17
|
-
const unknown = error?.code === 'outcome_unknown';
|
|
18
|
-
return { error: { code: codes.has(error?.code) ? error.code : 'request_failed',
|
|
19
|
-
status: Number.isInteger(error?.status) && error.status >= 0 && error.status <= 599 ? error.status : 0,
|
|
20
|
-
message: unknown ? 'Outcome unknown. Check current state before retrying.' : 'Request failed. Private error details omitted.',
|
|
21
|
-
...(unknown ? { outcome: 'unknown', safe_to_retry: false } : {}) } };
|
|
22
|
-
}
|
|
23
|
-
/** Approved success-output change only. Preserve errors, retries and all other fields. */
|
|
24
|
-
export async function privateWebhookRead(action) {
|
|
25
|
-
const value = await action();
|
|
26
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) return value;
|
|
27
|
-
const result = { ...value };
|
|
28
|
-
for (const field of ['webhook_url', 'webhook_url_2']) {
|
|
29
|
-
if (Object.hasOwn(result, field) && result[field] !== null) result[field] = '[omitted: private URL]';
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
1
|
+
const allowed = new Set(['ok','phone_number','agent_id','provider','is_active','deleted','web_calls_enabled',
|
|
2
|
+
'id','name','functions','method','timeout_ms','has_headers','is_set','api_key_set','webhook_url_set',
|
|
3
|
+
'post_call_url_set','in_call_url_set','pit_set','username','event_slug','default_timezone','location_id','tags','tool_name']);
|
|
4
|
+
export function integrationOutput(value) {
|
|
5
|
+
if (Array.isArray(value)) return value.map(integrationOutput);
|
|
6
|
+
if (!value || typeof value !== 'object') return value;
|
|
7
|
+
const result = { private_fields_omitted: true };
|
|
8
|
+
for (const [key, item] of Object.entries(value)) {
|
|
9
|
+
if (/(?:^|_)url(?:_2)?$/.test(key)) result[key] = item == null ? null : '[omitted: private URL]';
|
|
10
|
+
else if (allowed.has(key)) result[key] = integrationOutput(item);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
const codes = new Set(['invalid_filter','not_found','server_error','organisation_disabled','organisation_unavailable',
|
|
15
|
+
'unauthorized','invalid_api_key','forbidden','rate_limit_exceeded','owner_required','outcome_unknown','invalid_business_name']);
|
|
16
|
+
export function privateError(error) {
|
|
17
|
+
const unknown = error?.code === 'outcome_unknown';
|
|
18
|
+
return { error: { code: codes.has(error?.code) ? error.code : 'request_failed',
|
|
19
|
+
status: Number.isInteger(error?.status) && error.status >= 0 && error.status <= 599 ? error.status : 0,
|
|
20
|
+
message: unknown ? 'Outcome unknown. Check current state before retrying.' : 'Request failed. Private error details omitted.',
|
|
21
|
+
...(unknown ? { outcome: 'unknown', safe_to_retry: false } : {}) } };
|
|
22
|
+
}
|
|
23
|
+
/** Approved success-output change only. Preserve errors, retries and all other fields. */
|
|
24
|
+
export async function privateWebhookRead(action) {
|
|
25
|
+
const value = await action();
|
|
26
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return value;
|
|
27
|
+
const result = { ...value };
|
|
28
|
+
for (const field of ['webhook_url', 'webhook_url_2']) {
|
|
29
|
+
if (Object.hasOwn(result, field) && result[field] !== null) result[field] = '[omitted: private URL]';
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
package/c6-tools.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { executeTool } from './safe-tools.js';
|
|
3
|
-
import { integrationOutput, privateError } from './c6-output.js';
|
|
4
|
-
|
|
5
|
-
/** K4 scope approved by Fahim, 2 November 2026. */
|
|
6
|
-
export function registerC6Tools(server, request) {
|
|
7
|
-
const number = z.string().regex(/^\+[1-9]\d{6,14}$/);
|
|
8
|
-
const identity = z.object({ phone_number: number });
|
|
9
|
-
const agent = z.object({ agent_id: z.string().min(1).max(200) });
|
|
10
|
-
const enc = encodeURIComponent;
|
|
11
|
-
const add = (name, schema, description, read, fn, project = value => value) => server.registerTool(name, {
|
|
12
|
-
title: name.replaceAll('_', ' '), description: description + (read ? ' Use only for information the user requests.' : " Use only for the user's explicitly requested change. Requires confirm:true before any request; never automatically repeat an uncertain change."),
|
|
13
|
-
inputSchema: schema, annotations: { title: name.replaceAll('_', ' '), readOnlyHint: read, destructiveHint: !read, idempotentHint: read, openWorldHint: true },
|
|
14
|
-
}, async args => {
|
|
15
|
-
try {
|
|
16
|
-
const { confirm, ...input } = args;
|
|
17
|
-
const data = !read && confirm !== true ? { confirmation_required: true, sent: false, message: 'No request sent. Confirm only this intentional change.' } : project(await executeTool(name, fn, input));
|
|
18
|
-
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
|
|
19
|
-
} catch (error) { return { isError: true, content: [{ type: 'text', text: JSON.stringify(privateError(error)) }] }; }
|
|
20
|
-
});
|
|
21
|
-
for (const [provider, name] of [['calcom','get_calcom'],['slack','get_slack'],['zapier','get_zapier'],['make','get_make'],['gohighlevel','get_gohighlevel'],['web-calls','get_number_web_calls'],['precall','get_number_precall']]) {
|
|
22
|
-
add(name, identity, 'Read saved '+provider+' settings on an owned number. Credentials, private URLs and free-form configuration are omitted. Saved flags do not prove effective availability; a missing config may return 404.', true,
|
|
23
|
-
({ phone_number }) => request('GET', `/integrations/${provider}/number/${enc(phone_number)}`), integrationOutput);
|
|
24
|
-
}
|
|
25
|
-
add('get_agent_precall', agent, 'Read the saved agent pre-call default. Private URL omitted. A number override takes precedence.', true,
|
|
26
|
-
({ agent_id }) => request('GET', `/integrations/precall/agent/${enc(agent_id)}`), integrationOutput);
|
|
27
|
-
add('list_custom_functions', identity, 'List at most 15 saved functions. No paging. Empty does not prove number ownership. URLs, private headers, schemas and free-form text are omitted.', true,
|
|
28
|
-
({ phone_number }) => request('GET', `/integrations/custom-functions/number/${enc(phone_number)}`), integrationOutput);
|
|
29
|
-
add('list_organisation_activity_filtered', z.object({ before: z.string().regex(/^\d{1,18}$/).optional(), actor: z.uuid().optional(), from: z.iso.date().optional(), to: z.iso.date().optional() }),
|
|
30
|
-
'Read up to 50 activity events using inclusive UTC dates within retained history. Keep IDs and next_cursor as strings; pass next_cursor as before. API key has Owner authority. Full CSV export is SDK/CLI only.', true,
|
|
31
|
-
query => request('GET', '/organisation/activity', undefined, query));
|
|
32
|
-
add('rename_organisation', z.object({ name: z.string().min(2).max(100).regex(/^[^\u0000-\u001f\u007f]+$/), confirm: z.boolean().optional() }),
|
|
33
|
-
'Change only the business name. API key has Owner authority; no membership or ownership transfer.', false,
|
|
34
|
-
body => request('PATCH', '/organisation/name', body));
|
|
35
|
-
}
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { executeTool } from './safe-tools.js';
|
|
3
|
+
import { integrationOutput, privateError } from './c6-output.js';
|
|
4
|
+
|
|
5
|
+
/** K4 scope approved by Fahim, 2 November 2026. */
|
|
6
|
+
export function registerC6Tools(server, request) {
|
|
7
|
+
const number = z.string().regex(/^\+[1-9]\d{6,14}$/);
|
|
8
|
+
const identity = z.object({ phone_number: number });
|
|
9
|
+
const agent = z.object({ agent_id: z.string().min(1).max(200) });
|
|
10
|
+
const enc = encodeURIComponent;
|
|
11
|
+
const add = (name, schema, description, read, fn, project = value => value) => server.registerTool(name, {
|
|
12
|
+
title: name.replaceAll('_', ' '), description: description + (read ? ' Use only for information the user requests.' : " Use only for the user's explicitly requested change. Requires confirm:true before any request; never automatically repeat an uncertain change."),
|
|
13
|
+
inputSchema: schema, annotations: { title: name.replaceAll('_', ' '), readOnlyHint: read, destructiveHint: !read, idempotentHint: read, openWorldHint: true },
|
|
14
|
+
}, async args => {
|
|
15
|
+
try {
|
|
16
|
+
const { confirm, ...input } = args;
|
|
17
|
+
const data = !read && confirm !== true ? { confirmation_required: true, sent: false, message: 'No request sent. Confirm only this intentional change.' } : project(await executeTool(name, fn, input));
|
|
18
|
+
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
|
|
19
|
+
} catch (error) { return { isError: true, content: [{ type: 'text', text: JSON.stringify(privateError(error)) }] }; }
|
|
20
|
+
});
|
|
21
|
+
for (const [provider, name] of [['calcom','get_calcom'],['slack','get_slack'],['zapier','get_zapier'],['make','get_make'],['gohighlevel','get_gohighlevel'],['web-calls','get_number_web_calls'],['precall','get_number_precall']]) {
|
|
22
|
+
add(name, identity, 'Read saved '+provider+' settings on an owned number. Credentials, private URLs and free-form configuration are omitted. Saved flags do not prove effective availability; a missing config may return 404.', true,
|
|
23
|
+
({ phone_number }) => request('GET', `/integrations/${provider}/number/${enc(phone_number)}`), integrationOutput);
|
|
24
|
+
}
|
|
25
|
+
add('get_agent_precall', agent, 'Read the saved agent pre-call default. Private URL omitted. A number override takes precedence.', true,
|
|
26
|
+
({ agent_id }) => request('GET', `/integrations/precall/agent/${enc(agent_id)}`), integrationOutput);
|
|
27
|
+
add('list_custom_functions', identity, 'List at most 15 saved functions. No paging. Empty does not prove number ownership. URLs, private headers, schemas and free-form text are omitted.', true,
|
|
28
|
+
({ phone_number }) => request('GET', `/integrations/custom-functions/number/${enc(phone_number)}`), integrationOutput);
|
|
29
|
+
add('list_organisation_activity_filtered', z.object({ before: z.string().regex(/^\d{1,18}$/).optional(), actor: z.uuid().optional(), from: z.iso.date().optional(), to: z.iso.date().optional() }),
|
|
30
|
+
'Read up to 50 activity events using inclusive UTC dates within retained history. Keep IDs and next_cursor as strings; pass next_cursor as before. API key has Owner authority. Full CSV export is SDK/CLI only.', true,
|
|
31
|
+
query => request('GET', '/organisation/activity', undefined, query));
|
|
32
|
+
add('rename_organisation', z.object({ name: z.string().min(2).max(100).regex(/^[^\u0000-\u001f\u007f]+$/), confirm: z.boolean().optional() }),
|
|
33
|
+
'Change only the business name. API key has Owner authority; no membership or ownership transfer.', false,
|
|
34
|
+
body => request('PATCH', '/organisation/name', body));
|
|
35
|
+
}
|
package/call-reads.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// GET-only compatibility adapter for installed SDK 0.8.0. Mutations stay unchanged.
|
|
2
|
-
import * as z from 'zod/v4';
|
|
3
|
-
import { NixflexConnectionError, errorFromResponse } from 'nixflex';
|
|
4
|
-
import { summariseCall } from './call-tools.js';
|
|
5
|
-
export const callListSchema = z.object({
|
|
6
|
-
history: z.boolean().optional().describe('True: filtered metadata, totals and next_cursor. Default: legacy summary array.'),
|
|
7
|
-
limit: z.number().int().min(1).max(200).optional(), offset: z.number().int().min(0).max(1000000).optional(),
|
|
8
|
-
cursor: z.string().max(4096).optional(), agent_id: z.string().max(200).optional(), agent: z.string().max(200).optional(),
|
|
9
|
-
number: z.string().max(80).optional(), search: z.string().max(120).optional(),
|
|
10
|
-
direction: z.enum(['all','inbound','outbound','web']).optional(),
|
|
11
|
-
outcome: z.enum(['all','successful','unsuccessful','unknown','failed']).optional(),
|
|
12
|
-
source: z.enum(['all','campaign','web','test','other']).optional(),
|
|
13
|
-
period: z.enum(['all','today','week','month']).optional(), since: z.string().max(40).optional(), until: z.string().max(40).optional()
|
|
14
|
-
});
|
|
15
|
-
export const callGetSchema = z.object({call_id:z.string().min(1).max(200),view:z.enum(['detail','recording']).optional()});
|
|
16
|
-
export function callReads(apiKey, baseUrl='https://api.nixflex.com', fetcher=fetch) {
|
|
17
|
-
async function get(path, params={}) {
|
|
18
|
-
const url=new URL(baseUrl.replace(/\/+$/,'')+'/v1'+path);
|
|
19
|
-
for(const [k,v] of Object.entries(params))if(v!==undefined)url.searchParams.set(k,String(v));
|
|
20
|
-
let r,body;
|
|
21
|
-
try{r=await fetcher(url.toString(),{method:'GET',redirect:'error',signal:AbortSignal.timeout(30000),headers:{Authorization:'Bearer '+apiKey,Accept:'application/json'}});}
|
|
22
|
-
catch{throw new NixflexConnectionError('Could not read calls.');}
|
|
23
|
-
try{body=await r.json();}catch{throw new NixflexConnectionError('Invalid call response.');}
|
|
24
|
-
if(!r.ok)throw errorFromResponse(r.status,body,r.headers.get('x-railway-request-id')||undefined,Number(r.headers.get('retry-after'))||undefined);
|
|
25
|
-
return body;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
async list(args={}, summary=summariseCall) {
|
|
29
|
-
const {history,agent_id,...params}=callListSchema.parse(args);
|
|
30
|
-
if(agent_id!==undefined&¶ms.agent!==undefined)throw Error('Use agent or agent_id, not both.');
|
|
31
|
-
if(agent_id!==undefined)params.agent=agent_id;
|
|
32
|
-
const enhanced=history===true||Object.keys(params).some(k=>!['limit','offset'].includes(k));
|
|
33
|
-
if(!enhanced){const rows=await get('/calls',params);if(!Array.isArray(rows))throw new NixflexConnectionError('Invalid call list.');return rows.map(summary);}
|
|
34
|
-
const page=await get('/calls/history',params);
|
|
35
|
-
if(!Array.isArray(page?.data)||!page.totals||typeof page.has_more!=='boolean')throw new NixflexConnectionError('Invalid call history.');
|
|
36
|
-
return history===true?{...page,data:page.data.map(row=>({...summary(row),cost:row.cost,payload_deleted_at:row.payload_deleted_at??null}))}:page.data.map(summary);
|
|
37
|
-
},
|
|
38
|
-
async one(args) {
|
|
39
|
-
const {call_id,view}=callGetSchema.parse(args),path='/calls/'+encodeURIComponent(call_id);
|
|
40
|
-
return get(view&&view!=='detail'?path+'/'+view:path,view==='detail'?{view:'detail'}:{});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
1
|
+
// GET-only compatibility adapter for installed SDK 0.8.0. Mutations stay unchanged.
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
|
+
import { NixflexConnectionError, errorFromResponse } from 'nixflex';
|
|
4
|
+
import { summariseCall } from './call-tools.js';
|
|
5
|
+
export const callListSchema = z.object({
|
|
6
|
+
history: z.boolean().optional().describe('True: filtered metadata, totals and next_cursor. Default: legacy summary array.'),
|
|
7
|
+
limit: z.number().int().min(1).max(200).optional(), offset: z.number().int().min(0).max(1000000).optional(),
|
|
8
|
+
cursor: z.string().max(4096).optional(), agent_id: z.string().max(200).optional(), agent: z.string().max(200).optional(),
|
|
9
|
+
number: z.string().max(80).optional(), search: z.string().max(120).optional(),
|
|
10
|
+
direction: z.enum(['all','inbound','outbound','web']).optional(),
|
|
11
|
+
outcome: z.enum(['all','successful','unsuccessful','unknown','failed']).optional(),
|
|
12
|
+
source: z.enum(['all','campaign','web','test','other']).optional(),
|
|
13
|
+
period: z.enum(['all','today','week','month']).optional(), since: z.string().max(40).optional(), until: z.string().max(40).optional()
|
|
14
|
+
});
|
|
15
|
+
export const callGetSchema = z.object({call_id:z.string().min(1).max(200),view:z.enum(['detail','recording']).optional()});
|
|
16
|
+
export function callReads(apiKey, baseUrl='https://api.nixflex.com', fetcher=fetch) {
|
|
17
|
+
async function get(path, params={}) {
|
|
18
|
+
const url=new URL(baseUrl.replace(/\/+$/,'')+'/v1'+path);
|
|
19
|
+
for(const [k,v] of Object.entries(params))if(v!==undefined)url.searchParams.set(k,String(v));
|
|
20
|
+
let r,body;
|
|
21
|
+
try{r=await fetcher(url.toString(),{method:'GET',redirect:'error',signal:AbortSignal.timeout(30000),headers:{Authorization:'Bearer '+apiKey,Accept:'application/json'}});}
|
|
22
|
+
catch{throw new NixflexConnectionError('Could not read calls.');}
|
|
23
|
+
try{body=await r.json();}catch{throw new NixflexConnectionError('Invalid call response.');}
|
|
24
|
+
if(!r.ok)throw errorFromResponse(r.status,body,r.headers.get('x-railway-request-id')||undefined,Number(r.headers.get('retry-after'))||undefined);
|
|
25
|
+
return body;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
async list(args={}, summary=summariseCall) {
|
|
29
|
+
const {history,agent_id,...params}=callListSchema.parse(args);
|
|
30
|
+
if(agent_id!==undefined&¶ms.agent!==undefined)throw Error('Use agent or agent_id, not both.');
|
|
31
|
+
if(agent_id!==undefined)params.agent=agent_id;
|
|
32
|
+
const enhanced=history===true||Object.keys(params).some(k=>!['limit','offset'].includes(k));
|
|
33
|
+
if(!enhanced){const rows=await get('/calls',params);if(!Array.isArray(rows))throw new NixflexConnectionError('Invalid call list.');return rows.map(summary);}
|
|
34
|
+
const page=await get('/calls/history',params);
|
|
35
|
+
if(!Array.isArray(page?.data)||!page.totals||typeof page.has_more!=='boolean')throw new NixflexConnectionError('Invalid call history.');
|
|
36
|
+
return history===true?{...page,data:page.data.map(row=>({...summary(row),cost:row.cost,payload_deleted_at:row.payload_deleted_at??null}))}:page.data.map(summary);
|
|
37
|
+
},
|
|
38
|
+
async one(args) {
|
|
39
|
+
const {call_id,view}=callGetSchema.parse(args),path='/calls/'+encodeURIComponent(call_id);
|
|
40
|
+
return get(view&&view!=='detail'?path+'/'+view:path,view==='detail'?{view:'detail'}:{});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
package/call-tools.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// Translate the existing ergonomic tool argument, not the campaign recipient shape.
|
|
2
|
-
export function createCallBody({ variables, ...body }) {
|
|
3
|
-
if (variables !== undefined) {
|
|
4
|
-
if (Object.hasOwn(body, 'dynamic_vars')) throw new Error('Use variables or dynamic_vars, not both.');
|
|
5
|
-
body.dynamic_vars = variables;
|
|
6
|
-
}
|
|
7
|
-
return body;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function summariseCall(c) {
|
|
11
|
-
// Current API uses call_direction/call_type; retain older direction fallback.
|
|
12
|
-
const direction = [c.call_direction, c.call_type, c.direction]
|
|
13
|
-
.find(value => ['inbound', 'outbound', 'web'].includes(value)) ?? null;
|
|
14
|
-
return {
|
|
15
|
-
call_id: c.call_id, direction, from_number: c.from_number, to_number: c.to_number,
|
|
16
|
-
agent_id: c.agent_id, call_status: c.call_status, ended_reason: c.ended_reason,
|
|
17
|
-
duration_ms: c.duration_ms, started_at: c.start_timestamp ?? c.created_at ?? null,
|
|
18
|
-
call_summary: c.call_summary, call_successful: c.call_successful,
|
|
19
|
-
caller_sentiment: c.caller_sentiment,
|
|
20
|
-
bookings: Array.isArray(c.bookings) ? c.bookings.length : null,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
1
|
+
// Translate the existing ergonomic tool argument, not the campaign recipient shape.
|
|
2
|
+
export function createCallBody({ variables, ...body }) {
|
|
3
|
+
if (variables !== undefined) {
|
|
4
|
+
if (Object.hasOwn(body, 'dynamic_vars')) throw new Error('Use variables or dynamic_vars, not both.');
|
|
5
|
+
body.dynamic_vars = variables;
|
|
6
|
+
}
|
|
7
|
+
return body;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function summariseCall(c) {
|
|
11
|
+
// Current API uses call_direction/call_type; retain older direction fallback.
|
|
12
|
+
const direction = [c.call_direction, c.call_type, c.direction]
|
|
13
|
+
.find(value => ['inbound', 'outbound', 'web'].includes(value)) ?? null;
|
|
14
|
+
return {
|
|
15
|
+
call_id: c.call_id, direction, from_number: c.from_number, to_number: c.to_number,
|
|
16
|
+
agent_id: c.agent_id, call_status: c.call_status, ended_reason: c.ended_reason,
|
|
17
|
+
duration_ms: c.duration_ms, started_at: c.start_timestamp ?? c.created_at ?? null,
|
|
18
|
+
call_summary: c.call_summary, call_successful: c.call_successful,
|
|
19
|
+
caller_sentiment: c.caller_sentiment,
|
|
20
|
+
bookings: Array.isArray(c.bookings) ? c.bookings.length : null,
|
|
21
|
+
};
|
|
22
|
+
}
|
package/campaign-schema.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
const phone = z.string().regex(/^\+[1-9]\d{6,14}$/);
|
|
3
|
-
export const contactLocation = {
|
|
4
|
-
recipient_country: z.string().optional(), recipient_timezone: z.string().optional(),
|
|
5
|
-
};
|
|
6
|
-
const recipient = z.object({ phone, country: z.string().optional(), timezone: z.string().optional(),
|
|
7
|
-
variables: z.record(z.string(), z.string()).optional(), prompt_override: z.string().optional() });
|
|
8
|
-
const policy = {
|
|
9
|
-
consent_confirmed: z.boolean().optional(), duplicate_policy: z.enum(['allow','warn','reject']).optional(),
|
|
10
|
-
allow_wider_hours: z.boolean().optional(), hours_confirmation: z.string().min(20).max(1000).optional(),
|
|
11
|
-
schedule_type: z.enum(['now','schedule']).optional(), scheduled_date: z.string().optional(),
|
|
12
|
-
window_start_minutes: z.number().int().optional(), window_end_minutes: z.number().int().optional(),
|
|
13
|
-
window_days: z.array(z.enum(['sun','mon','tue','wed','thu','fri','sat'])).optional(),
|
|
14
|
-
timezone: z.string().optional(), skip_invalid: z.boolean().optional(),
|
|
15
|
-
reply_window_hours: z.number().optional(), reply_context_prompt: z.string().optional(),
|
|
16
|
-
};
|
|
17
|
-
const common = { agent_id: z.string(), from_number: phone, name: z.string().optional(),
|
|
18
|
-
recipients: z.array(recipient).min(1), ...policy, fields: z.record(z.string(), z.unknown()).optional() };
|
|
19
|
-
export const voiceCampaignSchema = z.object({ ...common, prompt: z.string() });
|
|
20
|
-
export const smsCampaignSchema = z.object({ ...common,
|
|
21
|
-
message: z.string().optional().describe('Compatibility alias for message_template; provide only one.'),
|
|
22
|
-
message_template: z.string().optional(),
|
|
23
|
-
}).refine(a => (a.message !== undefined) !== (a.message_template !== undefined || a.fields?.message_template !== undefined),
|
|
24
|
-
{ message: 'Provide message or message_template, not both.' });
|
|
25
|
-
export function campaignBody({ fields, ...rest }) {
|
|
26
|
-
for (const key of Object.keys(fields || {})) if (rest[key] !== undefined)
|
|
27
|
-
throw new Error('Use a top-level field or fields.' + key + ', not both.');
|
|
28
|
-
const body = { ...rest, ...fields };
|
|
29
|
-
if (body.message !== undefined) { body.message_template = body.message; delete body.message; }
|
|
30
|
-
if (body.scheduled_at !== undefined) {
|
|
31
|
-
if (body.scheduled_date !== undefined) throw new Error('Use scheduled_date only.');
|
|
32
|
-
body.scheduled_date = body.scheduled_at; delete body.scheduled_at;
|
|
33
|
-
}
|
|
34
|
-
return body;
|
|
35
|
-
}
|
|
36
|
-
export const smsListSchema = z.object({status:z.string().optional(),limit:z.number().int().min(1).max(1000).optional(),before:z.string().optional()});
|
|
37
|
-
export const smsDetailSchema = z.object({campaign_id:z.string(),limit:z.number().int().min(1).max(500).optional(),
|
|
38
|
-
recipient_cursor:z.string().optional(),message_cursor:z.string().optional()});
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
const phone = z.string().regex(/^\+[1-9]\d{6,14}$/);
|
|
3
|
+
export const contactLocation = {
|
|
4
|
+
recipient_country: z.string().optional(), recipient_timezone: z.string().optional(),
|
|
5
|
+
};
|
|
6
|
+
const recipient = z.object({ phone, country: z.string().optional(), timezone: z.string().optional(),
|
|
7
|
+
variables: z.record(z.string(), z.string()).optional(), prompt_override: z.string().optional() });
|
|
8
|
+
const policy = {
|
|
9
|
+
consent_confirmed: z.boolean().optional(), duplicate_policy: z.enum(['allow','warn','reject']).optional(),
|
|
10
|
+
allow_wider_hours: z.boolean().optional(), hours_confirmation: z.string().min(20).max(1000).optional(),
|
|
11
|
+
schedule_type: z.enum(['now','schedule']).optional(), scheduled_date: z.string().optional(),
|
|
12
|
+
window_start_minutes: z.number().int().optional(), window_end_minutes: z.number().int().optional(),
|
|
13
|
+
window_days: z.array(z.enum(['sun','mon','tue','wed','thu','fri','sat'])).optional(),
|
|
14
|
+
timezone: z.string().optional(), skip_invalid: z.boolean().optional(),
|
|
15
|
+
reply_window_hours: z.number().optional(), reply_context_prompt: z.string().optional(),
|
|
16
|
+
};
|
|
17
|
+
const common = { agent_id: z.string(), from_number: phone, name: z.string().optional(),
|
|
18
|
+
recipients: z.array(recipient).min(1), ...policy, fields: z.record(z.string(), z.unknown()).optional() };
|
|
19
|
+
export const voiceCampaignSchema = z.object({ ...common, prompt: z.string() });
|
|
20
|
+
export const smsCampaignSchema = z.object({ ...common,
|
|
21
|
+
message: z.string().optional().describe('Compatibility alias for message_template; provide only one.'),
|
|
22
|
+
message_template: z.string().optional(),
|
|
23
|
+
}).refine(a => (a.message !== undefined) !== (a.message_template !== undefined || a.fields?.message_template !== undefined),
|
|
24
|
+
{ message: 'Provide message or message_template, not both.' });
|
|
25
|
+
export function campaignBody({ fields, ...rest }) {
|
|
26
|
+
for (const key of Object.keys(fields || {})) if (rest[key] !== undefined)
|
|
27
|
+
throw new Error('Use a top-level field or fields.' + key + ', not both.');
|
|
28
|
+
const body = { ...rest, ...fields };
|
|
29
|
+
if (body.message !== undefined) { body.message_template = body.message; delete body.message; }
|
|
30
|
+
if (body.scheduled_at !== undefined) {
|
|
31
|
+
if (body.scheduled_date !== undefined) throw new Error('Use scheduled_date only.');
|
|
32
|
+
body.scheduled_date = body.scheduled_at; delete body.scheduled_at;
|
|
33
|
+
}
|
|
34
|
+
return body;
|
|
35
|
+
}
|
|
36
|
+
export const smsListSchema = z.object({status:z.string().optional(),limit:z.number().int().min(1).max(1000).optional(),before:z.string().optional()});
|
|
37
|
+
export const smsDetailSchema = z.object({campaign_id:z.string(),limit:z.number().int().min(1).max(500).optional(),
|
|
38
|
+
recipient_cursor:z.string().optional(),message_cursor:z.string().optional()});
|
package/core-tools.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { executeTool, errorBody } from './safe-tools.js';
|
|
3
|
-
|
|
4
|
-
/** Additive K2 tools. Existing registrations and their confirmation behaviour stay intact. */
|
|
5
|
-
export function registerCoreTools(server, request) {
|
|
6
|
-
const context = { agent_id: z.string().optional(), agent_language: z.string().optional() };
|
|
7
|
-
const add = (name, title, description, read, schema, fn) => server.registerTool(name, {
|
|
8
|
-
title, description: description + (read ? ' Use only when the user requests this account information.' :
|
|
9
|
-
' Use only for the user\'s explicitly requested change. Requires confirm:true; otherwise previews only. Never automatically repeat an uncertain write.'),
|
|
10
|
-
inputSchema: schema,
|
|
11
|
-
annotations: { title, readOnlyHint: read, destructiveHint: !read, idempotentHint: read, openWorldHint: true },
|
|
12
|
-
}, async args => {
|
|
13
|
-
try {
|
|
14
|
-
const data = await executeTool(name, fn, args);
|
|
15
|
-
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
16
|
-
} catch (error) {
|
|
17
|
-
return { content: [{ type: 'text', text: JSON.stringify(errorBody(error)) }], isError: true };
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
add('get_account_retention', 'Read account retention defaults',
|
|
21
|
-
'Read saved defaults for new agents. processing_enabled is not proof of erasure.', true,
|
|
22
|
-
z.object({}), () => request('GET', '/account/retention'));
|
|
23
|
-
add('get_key_activity', 'Read API request activity',
|
|
24
|
-
'Retained request counts and top endpoints, not organisation audit events. Defaults to today in UTC.', true,
|
|
25
|
-
z.object({ period: z.enum(['today', '7d']).optional() }), args => request('GET', '/keys/activity', undefined, args));
|
|
26
|
-
add('list_voices', 'List available catalog voices',
|
|
27
|
-
'Neutral voice keys and compatibility. Defaults limit 50/availability active; server clamps limit 1..100. locale is a preference. agent_language overrides agent_id. Keep filters with next_cursor; on cursor_expired restart and deduplicate by voice_key. No total count.', true,
|
|
28
|
-
z.object({ ...context, language: z.string().optional(), gender: z.enum(['male', 'female', 'unknown']).optional(),
|
|
29
|
-
locale: z.string().optional(), availability: z.enum(['active', 'all']).optional(),
|
|
30
|
-
limit: z.number().int().optional(), cursor: z.string().optional() }),
|
|
31
|
-
args => request('GET', '/voices', undefined, args));
|
|
32
|
-
add('get_voice', 'Read one catalog voice',
|
|
33
|
-
'Read a voice by voice_key with optional agent compatibility. selectable:false is a valid result; missing preview does not mean unavailable.', true,
|
|
34
|
-
z.object({ voice_key: z.string(), ...context }), ({ voice_key, ...query }) =>
|
|
35
|
-
request('GET', '/voices/' + encodeURIComponent(voice_key), undefined, query));
|
|
36
|
-
}
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { executeTool, errorBody } from './safe-tools.js';
|
|
3
|
+
|
|
4
|
+
/** Additive K2 tools. Existing registrations and their confirmation behaviour stay intact. */
|
|
5
|
+
export function registerCoreTools(server, request) {
|
|
6
|
+
const context = { agent_id: z.string().optional(), agent_language: z.string().optional() };
|
|
7
|
+
const add = (name, title, description, read, schema, fn) => server.registerTool(name, {
|
|
8
|
+
title, description: description + (read ? ' Use only when the user requests this account information.' :
|
|
9
|
+
' Use only for the user\'s explicitly requested change. Requires confirm:true; otherwise previews only. Never automatically repeat an uncertain write.'),
|
|
10
|
+
inputSchema: schema,
|
|
11
|
+
annotations: { title, readOnlyHint: read, destructiveHint: !read, idempotentHint: read, openWorldHint: true },
|
|
12
|
+
}, async args => {
|
|
13
|
+
try {
|
|
14
|
+
const data = await executeTool(name, fn, args);
|
|
15
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return { content: [{ type: 'text', text: JSON.stringify(errorBody(error)) }], isError: true };
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
add('get_account_retention', 'Read account retention defaults',
|
|
21
|
+
'Read saved defaults for new agents. processing_enabled is not proof of erasure.', true,
|
|
22
|
+
z.object({}), () => request('GET', '/account/retention'));
|
|
23
|
+
add('get_key_activity', 'Read API request activity',
|
|
24
|
+
'Retained request counts and top endpoints, not organisation audit events. Defaults to today in UTC.', true,
|
|
25
|
+
z.object({ period: z.enum(['today', '7d']).optional() }), args => request('GET', '/keys/activity', undefined, args));
|
|
26
|
+
add('list_voices', 'List available catalog voices',
|
|
27
|
+
'Neutral voice keys and compatibility. Defaults limit 50/availability active; server clamps limit 1..100. locale is a preference. agent_language overrides agent_id. Keep filters with next_cursor; on cursor_expired restart and deduplicate by voice_key. No total count.', true,
|
|
28
|
+
z.object({ ...context, language: z.string().optional(), gender: z.enum(['male', 'female', 'unknown']).optional(),
|
|
29
|
+
locale: z.string().optional(), availability: z.enum(['active', 'all']).optional(),
|
|
30
|
+
limit: z.number().int().optional(), cursor: z.string().optional() }),
|
|
31
|
+
args => request('GET', '/voices', undefined, args));
|
|
32
|
+
add('get_voice', 'Read one catalog voice',
|
|
33
|
+
'Read a voice by voice_key with optional agent compatibility. selectable:false is a valid result; missing preview does not mean unavailable.', true,
|
|
34
|
+
z.object({ voice_key: z.string(), ...context }), ({ voice_key, ...query }) =>
|
|
35
|
+
request('GET', '/voices/' + encodeURIComponent(voice_key), undefined, query));
|
|
36
|
+
}
|