@talonic/mcp 0.1.80 → 0.1.82

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/dist/server.js CHANGED
@@ -2959,6 +2959,455 @@ function registerGrowthTools(server, getToken, baseUrl) {
2959
2959
  async (args) => handleGrowthToolsUsage(getToken, baseUrl, args)
2960
2960
  );
2961
2961
  }
2962
+ var contractIdArg = z.string().uuid().describe("Contract id (from talonic_contracts_register or talonic_contracts_issues).");
2963
+ var rowIdArg = z.string().uuid().describe(
2964
+ "Document row id on the contract: `documents[].id` from talonic_contracts_contract (not the workspace document id)."
2965
+ );
2966
+ var readOnly = {
2967
+ readOnlyHint: true,
2968
+ destructiveHint: false,
2969
+ idempotentHint: true,
2970
+ openWorldHint: false
2971
+ };
2972
+ var write = (idempotent, destructive = false) => ({
2973
+ readOnlyHint: false,
2974
+ destructiveHint: destructive,
2975
+ idempotentHint: idempotent,
2976
+ openWorldHint: false
2977
+ });
2978
+ var ROLES = ["master", "amendment", "renewal", "termination", "price_sheet", "other"];
2979
+ var STATUSES = ["draft", "active", "expired", "terminated", "unknown"];
2980
+ var DECISIONS = ["terminated", "notice_sent", "renewal_declined", "active"];
2981
+ var TERMS = [
2982
+ "title",
2983
+ "counterparty",
2984
+ "our_party",
2985
+ "family",
2986
+ "site",
2987
+ "signed_date",
2988
+ "effective_date",
2989
+ "expiry_date",
2990
+ "initial_term_months",
2991
+ "auto_renewal",
2992
+ "renewal_term_months",
2993
+ "notice_days",
2994
+ "notice_months",
2995
+ "terminated_on",
2996
+ "annual_value",
2997
+ "currency",
2998
+ "escalation_pct",
2999
+ "escalation_date",
3000
+ "min_commitment",
3001
+ "cap_amount",
3002
+ "payment_terms_days",
3003
+ "governing_law",
3004
+ "is_draft"
3005
+ ];
3006
+ var REGISTER_DESCRIPTION = [
3007
+ "List the workspace's contracts: key, title, counterparty, status, start, end in force, notice deadline, document count, next open date, and what Contract Pricing and Money Found report per contract.",
3008
+ "USE WHEN: getting an overview, finding a contract by key/name, or counting by status.",
3009
+ "NOT FOR: one contract's terms and documents (talonic_contracts_contract); what needs cleaning (talonic_contracts_issues).",
3010
+ "",
3011
+ "ARGS: `query` (key, title or counterparty contains), `status`, `key` (exact).",
3012
+ "RETURNS: data[] { id, contract_key, title, counterparty, status, effective_date, expiry_date, notice_deadline, documents, next_date, links }."
3013
+ ].join("\n");
3014
+ var registerInputSchema = {
3015
+ query: z.string().optional().describe("Key, title or counterparty contains."),
3016
+ status: z.enum(STATUSES).optional().describe("Only contracts in this status."),
3017
+ key: z.string().optional().describe("Exact contract key, e.g. '1042460' or '3042-WLV'.")
3018
+ };
3019
+ function handleRegister(getToken, baseUrl, args) {
3020
+ return runTool(
3021
+ () => apiJson(getToken, baseUrl, "GET", "/v1/contracts", {
3022
+ params: { q: args.query, status: args.status, key: args.key }
3023
+ })
3024
+ );
3025
+ }
3026
+ var CONTRACT_DESCRIPTION = [
3027
+ "Read one contract in full: terms in force (each with the document and verbatim quote it rests on), documents in fold order with what each states (unverified values carry their `problem`), key dates, decisions and links to the other apps.",
3028
+ "USE WHEN: checking or cleaning a contract; you need document row ids for talonic_contracts_update_document.",
3029
+ "NOT FOR: the list of contracts (talonic_contracts_register).",
3030
+ "",
3031
+ "ARGS: `contract_id`.",
3032
+ "RETURNS: { contract, documents[] { id, document_id, filename, role, excluded, extract }, key_dates[], links, decision, history }."
3033
+ ].join("\n");
3034
+ var contractInputSchema = { contract_id: contractIdArg };
3035
+ function handleContract(getToken, baseUrl, args) {
3036
+ return runTool(() => apiJson(getToken, baseUrl, "GET", `/v1/contracts/${args.contract_id}`));
3037
+ }
3038
+ var ISSUES_DESCRIPTION = [
3039
+ "The cleaning worklist: contracts that look wrong and why. Codes: several_base_contracts (one key holds several contracts), printed_number_differs, several_counterparties, several_sites, ended_by_message (an email read as the termination), unread_documents, no_dates, unverified_terms.",
3040
+ "USE WHEN: after an import, to decide what to fix; again after fixing, to confirm it is clean.",
3041
+ "NOT FOR: contracts that are fine (talonic_contracts_register).",
3042
+ "",
3043
+ "ARGS: `code` (only contracts with this issue, optional).",
3044
+ "RETURNS: data[] { contract_id, contract_key, title, status, issues[] { code, detail, document_ids } }. document_ids are workspace document ids; match them to documents[].document_id in talonic_contracts_contract."
3045
+ ].join("\n");
3046
+ var issuesInputSchema = {
3047
+ code: z.enum([
3048
+ "several_base_contracts",
3049
+ "printed_number_differs",
3050
+ "several_counterparties",
3051
+ "several_sites",
3052
+ "ended_by_message",
3053
+ "unread_documents",
3054
+ "no_dates",
3055
+ "unverified_terms"
3056
+ ]).optional().describe("Only contracts with this issue.")
3057
+ };
3058
+ async function handleIssues(getToken, baseUrl, args) {
3059
+ return runTool(async () => {
3060
+ const res = await apiJson(
3061
+ getToken,
3062
+ baseUrl,
3063
+ "GET",
3064
+ "/v1/contracts/issues"
3065
+ );
3066
+ return args.code ? { data: res.data.filter((c) => c.issues.some((i) => i.code === args.code)) } : res;
3067
+ });
3068
+ }
3069
+ var UPCOMING_DESCRIPTION = [
3070
+ "Open key dates across all contracts, soonest first: notice deadlines, ends of term, renewals, price changes, terminations, dated obligations. Dates marked handled are left out.",
3071
+ "USE WHEN: what needs someone soon; preparing a renewal or notice decision.",
3072
+ "NOT FOR: one contract's dates (talonic_contracts_contract).",
3073
+ "",
3074
+ "ARGS: `days` (horizon, default the workspace's alert horizon, 90).",
3075
+ "RETURNS: data[] { id, contract_id, contract_key, title, kind, due_date, days_left, label, quote }."
3076
+ ].join("\n");
3077
+ var upcomingInputSchema = {
3078
+ days: z.number().int().min(1).max(3650).optional().describe("Days ahead.")
3079
+ };
3080
+ function handleUpcoming(getToken, baseUrl, args) {
3081
+ return runTool(
3082
+ () => apiJson(getToken, baseUrl, "GET", "/v1/contracts/upcoming", { params: { days: args.days } })
3083
+ );
3084
+ }
3085
+ var CANDIDATES_DESCRIPTION = [
3086
+ "Contract documents whose terms have not been read yet, grouped by the contract key in their filename; keys Contract Pricing already models first.",
3087
+ "USE WHEN: choosing what to read, or checking how the documents will group before importing.",
3088
+ "NOT FOR: reading them (talonic_contracts_import).",
3089
+ "",
3090
+ "ARGS: `query` (filename contains).",
3091
+ "RETURNS: data[] { contract_key, in_price_baseline, documents[] { document_id, filename, import } }."
3092
+ ].join("\n");
3093
+ var candidatesInputSchema = { query: z.string().optional().describe("Filename contains.") };
3094
+ function handleCandidates(getToken, baseUrl, args) {
3095
+ return runTool(
3096
+ () => apiJson(getToken, baseUrl, "GET", "/v1/contracts/import/candidates", {
3097
+ params: { q: args.query }
3098
+ })
3099
+ );
3100
+ }
3101
+ var STATUS_DESCRIPTION = [
3102
+ "Where the read queue stands: counts by status (pending, running, done, failed) and the latest failures with their error.",
3103
+ "USE WHEN: after talonic_contracts_import, poll until pending and running are 0.",
3104
+ "NOT FOR: the contracts themselves (talonic_contracts_register).",
3105
+ "",
3106
+ "ARGS: none.",
3107
+ "RETURNS: { counts, failed[] { document_id, filename, error, attempts } }."
3108
+ ].join("\n");
3109
+ function handleImportStatus(getToken, baseUrl) {
3110
+ return runTool(() => apiJson(getToken, baseUrl, "GET", "/v1/contracts/import/status"));
3111
+ }
3112
+ var IMPORT_DESCRIPTION = [
3113
+ "Queue contract documents to be read; the platform reads them in the background (one model call each) and files each under its contract.",
3114
+ "USE WHEN: filling the app. `all: true` queues every unread candidate (narrow with query, contract_keys, only_priced; `limit` for a first batch); `document_ids` queues exactly those. Always run `all` with `dry_run: true` first and say how many documents it will read.",
3115
+ "NOT FOR: reading a contract again after cleaning (talonic_contracts_reread).",
3116
+ "",
3117
+ "ARGS: `all` or `document_ids`; with all: `query`, `contract_keys`, `only_priced`, `limit`, `dry_run`; with document_ids: `force` (read again even if read).",
3118
+ "RETURNS: all \u2192 { dry_run, contracts, documents, queued, skipped }; document_ids \u2192 { queued, skipped }. Then poll talonic_contracts_import_status."
3119
+ ].join("\n");
3120
+ var importInputSchema = {
3121
+ all: z.boolean().optional().describe("Queue every unread candidate (with the filters below)."),
3122
+ document_ids: z.array(z.string().uuid()).min(1).max(500).optional().describe("Workspace document ids to read."),
3123
+ query: z.string().optional().describe("all: only filenames containing this."),
3124
+ contract_keys: z.array(z.string()).max(2e3).optional().describe("all: only these contract keys."),
3125
+ only_priced: z.boolean().optional().describe("all: only keys Contract Pricing already models."),
3126
+ limit: z.number().int().min(1).max(2e4).optional().describe("all: queue at most this many documents."),
3127
+ dry_run: z.boolean().optional().describe("all: count only, queue nothing."),
3128
+ force: z.boolean().optional().describe("document_ids: read again even when already read.")
3129
+ };
3130
+ function handleImport(getToken, baseUrl, args) {
3131
+ if (!!args.all === !!args.document_ids?.length)
3132
+ return Promise.resolve(validationError("Pass either `all: true` or `document_ids`, not both."));
3133
+ if (args.all) {
3134
+ const { query, contract_keys, only_priced, limit: limit2, dry_run } = args;
3135
+ return runTool(
3136
+ () => apiJson(getToken, baseUrl, "POST", "/v1/contracts/import/all", {
3137
+ body: { query, contract_keys, only_priced, limit: limit2, dry_run }
3138
+ })
3139
+ );
3140
+ }
3141
+ return runTool(
3142
+ () => apiJson(getToken, baseUrl, "POST", "/v1/contracts/import", {
3143
+ body: { document_ids: args.document_ids, force: args.force }
3144
+ })
3145
+ );
3146
+ }
3147
+ var UPDATE_DOCUMENT_DESCRIPTION = [
3148
+ "Fix one document of a contract: set what it is (`role`), leave it out of the fold (`excluded`), file it under another contract key (`contract_key`; a new key creates that contract, null returns it to its derived key), or take it off the contract (`remove`).",
3149
+ "USE WHEN: cleaning \u2014 a key holds several contracts (move each set to its own key, e.g. '1042460-WLV / An der Walze 12'), an email is read as a termination (exclude it), an amendment is read as a base contract (role).",
3150
+ "NOT FOR: moving all documents of a contract at once (talonic_contracts_merge).",
3151
+ "",
3152
+ "ARGS: `contract_id`, `document_row_id`, and one or more of `role`, `excluded`, `contract_key`; or `remove: true` alone.",
3153
+ "RETURNS: the contract the document ends up in, recomputed. A hand-set key and role survive re-reading."
3154
+ ].join("\n");
3155
+ var updateDocumentInputSchema = {
3156
+ contract_id: contractIdArg,
3157
+ document_row_id: rowIdArg,
3158
+ role: z.enum(ROLES).optional().describe("What the document is."),
3159
+ excluded: z.boolean().optional().describe("true = leave it out of the contract's terms."),
3160
+ contract_key: z.string().max(64).nullable().optional().describe("File under this key; null = back to the derived key."),
3161
+ remove: z.boolean().optional().describe("Take the document off the contract (the document stays in the workspace).")
3162
+ };
3163
+ function handleUpdateDocument(getToken, baseUrl, args) {
3164
+ const path = `/v1/contracts/${args.contract_id}/documents/${args.document_row_id}`;
3165
+ if (args.remove) {
3166
+ if (args.role !== void 0 || args.excluded !== void 0 || args.contract_key !== void 0)
3167
+ return Promise.resolve(validationError("`remove` goes alone."));
3168
+ return runTool(() => apiJson(getToken, baseUrl, "DELETE", path));
3169
+ }
3170
+ if (args.role === void 0 && args.excluded === void 0 && args.contract_key === void 0)
3171
+ return Promise.resolve(
3172
+ validationError("Nothing to change: pass role, excluded, contract_key or remove.")
3173
+ );
3174
+ return runTool(
3175
+ () => apiJson(getToken, baseUrl, "PUT", path, {
3176
+ body: { role: args.role, excluded: args.excluded, contract_key: args.contract_key }
3177
+ })
3178
+ );
3179
+ }
3180
+ var MERGE_DESCRIPTION = [
3181
+ "Move every document of one contract under another key (the same contract read under two keys, e.g. '1042460' and '1042460-WLV'). The emptied contract disappears.",
3182
+ "USE WHEN: two register rows are the same contract.",
3183
+ "NOT FOR: moving single documents (talonic_contracts_update_document).",
3184
+ "",
3185
+ "ARGS: `contract_id` (the one to empty), `into_key`.",
3186
+ "RETURNS: { moved, contract } \u2014 the contract under into_key, recomputed."
3187
+ ].join("\n");
3188
+ var mergeInputSchema = {
3189
+ contract_id: contractIdArg,
3190
+ into_key: z.string().min(1).max(64).describe("The key to move everything under.")
3191
+ };
3192
+ function handleMerge(getToken, baseUrl, args) {
3193
+ return runTool(
3194
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/${args.contract_id}/merge`, {
3195
+ body: { into_key: args.into_key }
3196
+ })
3197
+ );
3198
+ }
3199
+ var REREAD_DESCRIPTION = [
3200
+ "Read a contract's documents again (or one of them), e.g. after cleaning or when values did not verify. One model call per document; hand-set values and roles are kept.",
3201
+ "USE WHEN: a contract's terms look wrong and the documents are right.",
3202
+ "NOT FOR: documents never read (talonic_contracts_import).",
3203
+ "",
3204
+ "ARGS: `contract_id`, `document_row_id` (optional, all when omitted).",
3205
+ "RETURNS: { queued, skipped }. Then poll talonic_contracts_import_status."
3206
+ ].join("\n");
3207
+ var rereadInputSchema = {
3208
+ contract_id: contractIdArg,
3209
+ document_row_id: rowIdArg.optional()
3210
+ };
3211
+ function handleReread(getToken, baseUrl, args) {
3212
+ return runTool(
3213
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/${args.contract_id}/reread`, {
3214
+ body: args.document_row_id ? { document_row_id: args.document_row_id } : {}
3215
+ })
3216
+ );
3217
+ }
3218
+ var DECIDE_DESCRIPTION = [
3219
+ "Record a decision on a contract: terminated, notice_sent, renewal_declined, or active (withdraws the earlier one). Recorded as made through the API key, with your note; the contract's status, end and key dates follow.",
3220
+ "USE WHEN: the user states the decision or it is confirmed by a document they point to. Never infer a termination on your own.",
3221
+ "NOT FOR: a termination letter already in the documents (it is read as a fact; check talonic_contracts_contract).",
3222
+ "",
3223
+ "ARGS: `contract_id`, `state`, `note` (say where the decision comes from).",
3224
+ "RETURNS: the contract, recomputed."
3225
+ ].join("\n");
3226
+ var decideInputSchema = {
3227
+ contract_id: contractIdArg,
3228
+ state: z.enum(DECISIONS),
3229
+ note: z.string().max(2e3).optional().describe("Source of the decision, e.g. 'K\xFCndigungsschreiben vom 12.01.2026'.")
3230
+ };
3231
+ function handleDecide(getToken, baseUrl, args) {
3232
+ return runTool(
3233
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/${args.contract_id}/decision`, {
3234
+ body: { state: args.state, note: args.note }
3235
+ })
3236
+ );
3237
+ }
3238
+ var KEY_DATE_DESCRIPTION = [
3239
+ "Mark a key date handled (or open again), e.g. a notice deadline someone has dealt with. Handled dates leave the upcoming list and raise no alert.",
3240
+ "USE WHEN: the user confirms a date is taken care of.",
3241
+ "NOT FOR: changing the date itself (it follows the documents).",
3242
+ "",
3243
+ "ARGS: `key_date_id` (key_dates[].id from talonic_contracts_contract or id from talonic_contracts_upcoming), `handled`, `note`.",
3244
+ "RETURNS: { id, handled }."
3245
+ ].join("\n");
3246
+ var keyDateInputSchema = {
3247
+ key_date_id: z.string().uuid(),
3248
+ handled: z.boolean(),
3249
+ note: z.string().max(2e3).optional()
3250
+ };
3251
+ function handleKeyDate(getToken, baseUrl, args) {
3252
+ return runTool(
3253
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/key-dates/${args.key_date_id}`, {
3254
+ body: { handled: args.handled, note: args.note }
3255
+ })
3256
+ );
3257
+ }
3258
+ var SET_TERM_DESCRIPTION = [
3259
+ "Set one term on one document by hand, with the passage that states it copied verbatim from that document. The platform saves it only when the quote occurs in the document and prints the value.",
3260
+ "USE WHEN: a term was missed or read wrong and you have the exact passage (talonic_get_document or talonic_search to find it).",
3261
+ "NOT FOR: guessing a value; decisions (talonic_contracts_decide).",
3262
+ "",
3263
+ "ARGS: `contract_id`, `document_row_id`, `field`, `value` (ISO date for dates; fraction for escalation_pct; months for *_months), `quote`.",
3264
+ "RETURNS: the contract, recomputed; an error naming the problem when the quote does not verify."
3265
+ ].join("\n");
3266
+ var setTermInputSchema = {
3267
+ contract_id: contractIdArg,
3268
+ document_row_id: rowIdArg,
3269
+ field: z.enum(TERMS),
3270
+ value: z.union([z.string(), z.number(), z.boolean()]),
3271
+ quote: z.string().min(3).max(2e3).describe("Copied character for character from the document.")
3272
+ };
3273
+ function handleSetTerm(getToken, baseUrl, args) {
3274
+ const { field, value, quote } = args;
3275
+ return runTool(
3276
+ () => apiJson(
3277
+ getToken,
3278
+ baseUrl,
3279
+ "POST",
3280
+ `/v1/contracts/${args.contract_id}/documents/${args.document_row_id}/terms`,
3281
+ { body: { field, value, quote } }
3282
+ )
3283
+ );
3284
+ }
3285
+ async function probeContractsAccess(token, baseUrl) {
3286
+ try {
3287
+ const res = await fetch(buildUrl(baseUrl, "/v1/contracts/import/status"), {
3288
+ headers: { Authorization: `Bearer ${token}`, Accept: "application/json" },
3289
+ signal: AbortSignal.timeout(5e3)
3290
+ });
3291
+ return res.ok;
3292
+ } catch {
3293
+ return false;
3294
+ }
3295
+ }
3296
+ function registerContractsTools(server, getToken, baseUrl) {
3297
+ const tools = [
3298
+ [
3299
+ "talonic_contracts_register",
3300
+ "List contracts",
3301
+ REGISTER_DESCRIPTION,
3302
+ registerInputSchema,
3303
+ readOnly,
3304
+ (a) => handleRegister(getToken, baseUrl, a)
3305
+ ],
3306
+ [
3307
+ "talonic_contracts_contract",
3308
+ "Read one contract",
3309
+ CONTRACT_DESCRIPTION,
3310
+ contractInputSchema,
3311
+ readOnly,
3312
+ (a) => handleContract(getToken, baseUrl, a)
3313
+ ],
3314
+ [
3315
+ "talonic_contracts_issues",
3316
+ "Contracts to clean",
3317
+ ISSUES_DESCRIPTION,
3318
+ issuesInputSchema,
3319
+ readOnly,
3320
+ (a) => handleIssues(getToken, baseUrl, a)
3321
+ ],
3322
+ [
3323
+ "talonic_contracts_upcoming",
3324
+ "Upcoming contract dates",
3325
+ UPCOMING_DESCRIPTION,
3326
+ upcomingInputSchema,
3327
+ readOnly,
3328
+ (a) => handleUpcoming(getToken, baseUrl, a)
3329
+ ],
3330
+ [
3331
+ "talonic_contracts_import_candidates",
3332
+ "Unread contract documents",
3333
+ CANDIDATES_DESCRIPTION,
3334
+ candidatesInputSchema,
3335
+ readOnly,
3336
+ (a) => handleCandidates(getToken, baseUrl, a)
3337
+ ],
3338
+ [
3339
+ "talonic_contracts_import_status",
3340
+ "Contract read queue",
3341
+ STATUS_DESCRIPTION,
3342
+ {},
3343
+ readOnly,
3344
+ () => handleImportStatus(getToken, baseUrl)
3345
+ ],
3346
+ [
3347
+ "talonic_contracts_import",
3348
+ "Read contract documents",
3349
+ IMPORT_DESCRIPTION,
3350
+ importInputSchema,
3351
+ write(true),
3352
+ (a) => handleImport(getToken, baseUrl, a)
3353
+ ],
3354
+ [
3355
+ "talonic_contracts_update_document",
3356
+ "Fix a contract document",
3357
+ UPDATE_DOCUMENT_DESCRIPTION,
3358
+ updateDocumentInputSchema,
3359
+ write(false, true),
3360
+ (a) => handleUpdateDocument(getToken, baseUrl, a)
3361
+ ],
3362
+ [
3363
+ "talonic_contracts_merge",
3364
+ "Merge two contracts",
3365
+ MERGE_DESCRIPTION,
3366
+ mergeInputSchema,
3367
+ write(true, true),
3368
+ (a) => handleMerge(getToken, baseUrl, a)
3369
+ ],
3370
+ [
3371
+ "talonic_contracts_reread",
3372
+ "Read a contract again",
3373
+ REREAD_DESCRIPTION,
3374
+ rereadInputSchema,
3375
+ write(true),
3376
+ (a) => handleReread(getToken, baseUrl, a)
3377
+ ],
3378
+ [
3379
+ "talonic_contracts_decide",
3380
+ "Record a contract decision",
3381
+ DECIDE_DESCRIPTION,
3382
+ decideInputSchema,
3383
+ write(true),
3384
+ (a) => handleDecide(getToken, baseUrl, a)
3385
+ ],
3386
+ [
3387
+ "talonic_contracts_key_date",
3388
+ "Mark a key date handled",
3389
+ KEY_DATE_DESCRIPTION,
3390
+ keyDateInputSchema,
3391
+ write(true),
3392
+ (a) => handleKeyDate(getToken, baseUrl, a)
3393
+ ],
3394
+ [
3395
+ "talonic_contracts_set_term",
3396
+ "Set a contract term with its quote",
3397
+ SET_TERM_DESCRIPTION,
3398
+ setTermInputSchema,
3399
+ write(true),
3400
+ (a) => handleSetTerm(getToken, baseUrl, a)
3401
+ ]
3402
+ ];
3403
+ for (const [name, title, description, inputSchema11, annotations, handler] of tools) {
3404
+ server.registerTool(
3405
+ name,
3406
+ { title, description, inputSchema: inputSchema11, annotations: { title, ...annotations } },
3407
+ async (args) => handler(args)
3408
+ );
3409
+ }
3410
+ }
2962
3411
  var DEFAULT_BASE3 = "https://api.talonic.com";
2963
3412
  var TASK_STATUSES = ["available", "claimed", "submitted", "timed_out", "cancelled"];
2964
3413
  var taskId = z.string().uuid().describe("Agent task UUID.");
@@ -3413,7 +3862,6 @@ var MUTATING2 = {
3413
3862
  openWorldHint: false
3414
3863
  };
3415
3864
  var AUTH_NOTE = "AUTH: a tlnc_ key needs a per-app 'decide' grant; an OAuth connector session needs the apps:decide scope (consented at connect) and a live workspace role of senior_member or above. A 403 (decide_grant_required, insufficient_scope, insufficient_tier) names what is missing \u2014 tell the user, do not retry.";
3416
- var NOT_INVOCABLE_PREFIX = "NOT INVOCABLE IN THIS SESSION: the connector's OAuth token lacks the apps:decide scope. Ask the user to reconnect the Talonic connector and approve 'Claim and decide tasks' before calling this; a call now returns 403 insufficient_scope.\n\n";
3417
3865
  var DESCRIPTIONS2 = {
3418
3866
  list: [
3419
3867
  "List one External-mode app's decision tasks (runs parked for an outside agent to decide), newest first.",
@@ -3473,7 +3921,6 @@ var DESCRIPTIONS2 = {
3473
3921
  };
3474
3922
  function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3475
3923
  const invocable = options.invocable !== false;
3476
- const describe = (text) => invocable ? text : NOT_INVOCABLE_PREFIX + text;
3477
3924
  const metaFor = (key) => ({
3478
3925
  _meta: {
3479
3926
  ...widgetToolMeta(key),
@@ -3484,7 +3931,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3484
3931
  "talonic_list_decision_tasks",
3485
3932
  {
3486
3933
  title: "List Decision Tasks",
3487
- description: describe(DESCRIPTIONS2.list),
3934
+ description: DESCRIPTIONS2.list,
3488
3935
  inputSchema: listInput2,
3489
3936
  annotations: { title: "List Decision Tasks", ...READ_ONLY3 },
3490
3937
  ...metaFor("listDecisionTasks")
@@ -3495,7 +3942,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3495
3942
  "talonic_claim_decision_task",
3496
3943
  {
3497
3944
  title: "Claim Decision Task",
3498
- description: describe(DESCRIPTIONS2.claim),
3945
+ description: DESCRIPTIONS2.claim,
3499
3946
  inputSchema: idInput2,
3500
3947
  annotations: { title: "Claim Decision Task", ...MUTATING2 },
3501
3948
  ...metaFor("claimDecisionTask")
@@ -3506,7 +3953,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3506
3953
  "talonic_read_decision_package",
3507
3954
  {
3508
3955
  title: "Read Decision Package",
3509
- description: describe(DESCRIPTIONS2.package),
3956
+ description: DESCRIPTIONS2.package,
3510
3957
  inputSchema: packageInput,
3511
3958
  annotations: { title: "Read Decision Package", ...READ_ONLY3 },
3512
3959
  ...metaFor("readDecisionPackage")
@@ -3517,7 +3964,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3517
3964
  "talonic_heartbeat_decision_task",
3518
3965
  {
3519
3966
  title: "Heartbeat Decision Task",
3520
- description: describe(DESCRIPTIONS2.heartbeat),
3967
+ description: DESCRIPTIONS2.heartbeat,
3521
3968
  inputSchema: epochInput,
3522
3969
  annotations: { title: "Heartbeat Decision Task", ...MUTATING2 },
3523
3970
  ...metaFor("heartbeatDecisionTask")
@@ -3528,7 +3975,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3528
3975
  "talonic_submit_decision_task",
3529
3976
  {
3530
3977
  title: "Submit Decision Task",
3531
- description: describe(DESCRIPTIONS2.submit),
3978
+ description: DESCRIPTIONS2.submit,
3532
3979
  inputSchema: submitInput2,
3533
3980
  annotations: { title: "Submit Decision Task", ...MUTATING2 },
3534
3981
  ...metaFor("submitDecisionTask")
@@ -3539,7 +3986,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3539
3986
  "talonic_release_decision_task",
3540
3987
  {
3541
3988
  title: "Release Decision Task",
3542
- description: describe(DESCRIPTIONS2.release),
3989
+ description: DESCRIPTIONS2.release,
3543
3990
  inputSchema: epochInput,
3544
3991
  annotations: { title: "Release Decision Task", ...MUTATING2 },
3545
3992
  ...metaFor("releaseDecisionTask")
@@ -3550,7 +3997,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3550
3997
  "talonic_fail_decision_task",
3551
3998
  {
3552
3999
  title: "Fail Decision Task",
3553
- description: describe(DESCRIPTIONS2.fail),
4000
+ description: DESCRIPTIONS2.fail,
3554
4001
  inputSchema: failInput,
3555
4002
  annotations: { title: "Fail Decision Task", ...MUTATING2 },
3556
4003
  ...metaFor("failDecisionTask")
@@ -3790,10 +4237,11 @@ function registerFieldTools(server, getToken, baseUrl) {
3790
4237
  server.registerTool(
3791
4238
  "talonic_list_fields",
3792
4239
  {
3793
- title: "List registry fields",
4240
+ title: "List Registry Fields",
3794
4241
  description: LIST_DESCRIPTION,
3795
4242
  inputSchema: listFieldsInputSchema,
3796
4243
  annotations: {
4244
+ title: "List Registry Fields",
3797
4245
  readOnlyHint: true,
3798
4246
  destructiveHint: false,
3799
4247
  idempotentHint: true,
@@ -3806,10 +4254,11 @@ function registerFieldTools(server, getToken, baseUrl) {
3806
4254
  server.registerTool(
3807
4255
  "talonic_get_field",
3808
4256
  {
3809
- title: "Get a field's concept card",
4257
+ title: "Get Field Concept Card",
3810
4258
  description: GET_DESCRIPTION,
3811
4259
  inputSchema: getFieldInputSchema,
3812
4260
  annotations: {
4261
+ title: "Get Field Concept Card",
3813
4262
  readOnlyHint: true,
3814
4263
  destructiveHint: false,
3815
4264
  idempotentHint: true,
@@ -3822,10 +4271,11 @@ function registerFieldTools(server, getToken, baseUrl) {
3822
4271
  server.registerTool(
3823
4272
  "talonic_field_values",
3824
4273
  {
3825
- title: "Read a field's values across documents",
4274
+ title: "Read Field Values",
3826
4275
  description: VALUES_DESCRIPTION,
3827
4276
  inputSchema: fieldValuesInputSchema,
3828
4277
  annotations: {
4278
+ title: "Read Field Values",
3829
4279
  readOnlyHint: true,
3830
4280
  destructiveHint: false,
3831
4281
  idempotentHint: true,
@@ -3960,10 +4410,11 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
3960
4410
  server.registerTool(
3961
4411
  "talonic_find_data",
3962
4412
  {
3963
- title: "Find the data behind a concept",
4413
+ title: "Find Data by Concept",
3964
4414
  description: FIND_DESCRIPTION,
3965
4415
  inputSchema: findDataInputSchema,
3966
4416
  annotations: {
4417
+ title: "Find Data by Concept",
3967
4418
  readOnlyHint: true,
3968
4419
  destructiveHint: false,
3969
4420
  idempotentHint: true,
@@ -3976,10 +4427,11 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
3976
4427
  server.registerTool(
3977
4428
  "talonic_list_agent_tools",
3978
4429
  {
3979
- title: "List the platform agent tools",
4430
+ title: "List Platform Agent Tools",
3980
4431
  description: LIST_TOOLS_DESCRIPTION,
3981
4432
  inputSchema: listAgentToolsInputSchema,
3982
4433
  annotations: {
4434
+ title: "List Platform Agent Tools",
3983
4435
  readOnlyHint: true,
3984
4436
  destructiveHint: false,
3985
4437
  idempotentHint: true,
@@ -3992,10 +4444,11 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
3992
4444
  server.registerTool(
3993
4445
  "talonic_invoke_agent_tool",
3994
4446
  {
3995
- title: "Invoke a platform agent tool",
4447
+ title: "Invoke Platform Agent Tool",
3996
4448
  description: INVOKE_DESCRIPTION,
3997
4449
  inputSchema: invokeAgentToolInputSchema,
3998
4450
  annotations: {
4451
+ title: "Invoke Platform Agent Tool",
3999
4452
  readOnlyHint: true,
4000
4453
  destructiveHint: false,
4001
4454
  idempotentHint: false,
@@ -4480,7 +4933,7 @@ function registerAskTools(server, getToken, baseUrl) {
4480
4933
 
4481
4934
  // package.json
4482
4935
  var package_default = {
4483
- version: "0.1.80"};
4936
+ version: "0.1.82"};
4484
4937
 
4485
4938
  // src/version.ts
4486
4939
  var VERSION = package_default.version;
@@ -4633,6 +5086,9 @@ function createServer(options) {
4633
5086
  if (options.includeAdminAgentTaskTools) {
4634
5087
  registerAdminAgentTaskTools(server, rawToken, baseUrl);
4635
5088
  }
5089
+ if (options.includeContractsTools) {
5090
+ registerContractsTools(server, rawToken, baseUrl);
5091
+ }
4636
5092
  registerSchemasResource(server, getTalonic);
4637
5093
  registerWebhooksResource(server, rawToken, baseUrl);
4638
5094
  registerWidgets(server);
@@ -4685,15 +5141,19 @@ async function main(argv = process.argv.slice(2), env = process.env, out = (line
4685
5141
  return 1;
4686
5142
  }
4687
5143
  const baseUrl = env["TALONIC_BASE_URL"];
4688
- const [includeGrowthTools, includeAdminAgentTaskTools] = await Promise.all([
4689
- probeGrowthAccess(apiKey, baseUrl),
4690
- probeAgentTaskAdminAccess(apiKey, baseUrl)
4691
- ]);
5144
+ const [includeGrowthTools, includeAdminAgentTaskTools, includeContractsTools] = await Promise.all(
5145
+ [
5146
+ probeGrowthAccess(apiKey, baseUrl),
5147
+ probeAgentTaskAdminAccess(apiKey, baseUrl),
5148
+ probeContractsAccess(apiKey, baseUrl)
5149
+ ]
5150
+ );
4692
5151
  const server = createServer({
4693
5152
  apiKey,
4694
5153
  ...baseUrl ? { baseUrl } : {},
4695
5154
  includeGrowthTools,
4696
- includeAdminAgentTaskTools
5155
+ includeAdminAgentTaskTools,
5156
+ includeContractsTools
4697
5157
  });
4698
5158
  const transport = new StdioServerTransport();
4699
5159
  await server.connect(transport);