@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/index.d.ts CHANGED
@@ -53,6 +53,12 @@ interface CreateServerOptions {
53
53
  * re-authorizes every call; this flag controls listing visibility only.
54
54
  */
55
55
  includeAdminAgentTaskTools?: boolean;
56
+ /**
57
+ * Register the `talonic_contracts_*` tools. Callers set this only after
58
+ * `probeContractsAccess` passed, so a deployment without the Contracts app
59
+ * never lists tools that would 404. Listing visibility only.
60
+ */
61
+ includeContractsTools?: boolean;
56
62
  /**
57
63
  * Whether the seven decision-task tools are listed as invocable. The hosted
58
64
  * entrypoint sets this from `tokenHasDecideScope`: an OAuth token that
package/dist/index.js CHANGED
@@ -2945,6 +2945,444 @@ function registerGrowthTools(server, getToken, baseUrl) {
2945
2945
  async (args) => handleGrowthToolsUsage(getToken, baseUrl, args)
2946
2946
  );
2947
2947
  }
2948
+ var contractIdArg = z.string().uuid().describe("Contract id (from talonic_contracts_register or talonic_contracts_issues).");
2949
+ var rowIdArg = z.string().uuid().describe(
2950
+ "Document row id on the contract: `documents[].id` from talonic_contracts_contract (not the workspace document id)."
2951
+ );
2952
+ var readOnly = {
2953
+ readOnlyHint: true,
2954
+ destructiveHint: false,
2955
+ idempotentHint: true,
2956
+ openWorldHint: false
2957
+ };
2958
+ var write = (idempotent, destructive = false) => ({
2959
+ readOnlyHint: false,
2960
+ destructiveHint: destructive,
2961
+ idempotentHint: idempotent,
2962
+ openWorldHint: false
2963
+ });
2964
+ var ROLES = ["master", "amendment", "renewal", "termination", "price_sheet", "other"];
2965
+ var STATUSES = ["draft", "active", "expired", "terminated", "unknown"];
2966
+ var DECISIONS = ["terminated", "notice_sent", "renewal_declined", "active"];
2967
+ var TERMS = [
2968
+ "title",
2969
+ "counterparty",
2970
+ "our_party",
2971
+ "family",
2972
+ "site",
2973
+ "signed_date",
2974
+ "effective_date",
2975
+ "expiry_date",
2976
+ "initial_term_months",
2977
+ "auto_renewal",
2978
+ "renewal_term_months",
2979
+ "notice_days",
2980
+ "notice_months",
2981
+ "terminated_on",
2982
+ "annual_value",
2983
+ "currency",
2984
+ "escalation_pct",
2985
+ "escalation_date",
2986
+ "min_commitment",
2987
+ "cap_amount",
2988
+ "payment_terms_days",
2989
+ "governing_law",
2990
+ "is_draft"
2991
+ ];
2992
+ var REGISTER_DESCRIPTION = [
2993
+ "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.",
2994
+ "USE WHEN: getting an overview, finding a contract by key/name, or counting by status.",
2995
+ "NOT FOR: one contract's terms and documents (talonic_contracts_contract); what needs cleaning (talonic_contracts_issues).",
2996
+ "",
2997
+ "ARGS: `query` (key, title or counterparty contains), `status`, `key` (exact).",
2998
+ "RETURNS: data[] { id, contract_key, title, counterparty, status, effective_date, expiry_date, notice_deadline, documents, next_date, links }."
2999
+ ].join("\n");
3000
+ var registerInputSchema = {
3001
+ query: z.string().optional().describe("Key, title or counterparty contains."),
3002
+ status: z.enum(STATUSES).optional().describe("Only contracts in this status."),
3003
+ key: z.string().optional().describe("Exact contract key, e.g. '1042460' or '3042-WLV'.")
3004
+ };
3005
+ function handleRegister(getToken, baseUrl, args) {
3006
+ return runTool(
3007
+ () => apiJson(getToken, baseUrl, "GET", "/v1/contracts", {
3008
+ params: { q: args.query, status: args.status, key: args.key }
3009
+ })
3010
+ );
3011
+ }
3012
+ var CONTRACT_DESCRIPTION = [
3013
+ "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.",
3014
+ "USE WHEN: checking or cleaning a contract; you need document row ids for talonic_contracts_update_document.",
3015
+ "NOT FOR: the list of contracts (talonic_contracts_register).",
3016
+ "",
3017
+ "ARGS: `contract_id`.",
3018
+ "RETURNS: { contract, documents[] { id, document_id, filename, role, excluded, extract }, key_dates[], links, decision, history }."
3019
+ ].join("\n");
3020
+ var contractInputSchema = { contract_id: contractIdArg };
3021
+ function handleContract(getToken, baseUrl, args) {
3022
+ return runTool(() => apiJson(getToken, baseUrl, "GET", `/v1/contracts/${args.contract_id}`));
3023
+ }
3024
+ var ISSUES_DESCRIPTION = [
3025
+ "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.",
3026
+ "USE WHEN: after an import, to decide what to fix; again after fixing, to confirm it is clean.",
3027
+ "NOT FOR: contracts that are fine (talonic_contracts_register).",
3028
+ "",
3029
+ "ARGS: `code` (only contracts with this issue, optional).",
3030
+ "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."
3031
+ ].join("\n");
3032
+ var issuesInputSchema = {
3033
+ code: z.enum([
3034
+ "several_base_contracts",
3035
+ "printed_number_differs",
3036
+ "several_counterparties",
3037
+ "several_sites",
3038
+ "ended_by_message",
3039
+ "unread_documents",
3040
+ "no_dates",
3041
+ "unverified_terms"
3042
+ ]).optional().describe("Only contracts with this issue.")
3043
+ };
3044
+ async function handleIssues(getToken, baseUrl, args) {
3045
+ return runTool(async () => {
3046
+ const res = await apiJson(
3047
+ getToken,
3048
+ baseUrl,
3049
+ "GET",
3050
+ "/v1/contracts/issues"
3051
+ );
3052
+ return args.code ? { data: res.data.filter((c) => c.issues.some((i) => i.code === args.code)) } : res;
3053
+ });
3054
+ }
3055
+ var UPCOMING_DESCRIPTION = [
3056
+ "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.",
3057
+ "USE WHEN: what needs someone soon; preparing a renewal or notice decision.",
3058
+ "NOT FOR: one contract's dates (talonic_contracts_contract).",
3059
+ "",
3060
+ "ARGS: `days` (horizon, default the workspace's alert horizon, 90).",
3061
+ "RETURNS: data[] { id, contract_id, contract_key, title, kind, due_date, days_left, label, quote }."
3062
+ ].join("\n");
3063
+ var upcomingInputSchema = {
3064
+ days: z.number().int().min(1).max(3650).optional().describe("Days ahead.")
3065
+ };
3066
+ function handleUpcoming(getToken, baseUrl, args) {
3067
+ return runTool(
3068
+ () => apiJson(getToken, baseUrl, "GET", "/v1/contracts/upcoming", { params: { days: args.days } })
3069
+ );
3070
+ }
3071
+ var CANDIDATES_DESCRIPTION = [
3072
+ "Contract documents whose terms have not been read yet, grouped by the contract key in their filename; keys Contract Pricing already models first.",
3073
+ "USE WHEN: choosing what to read, or checking how the documents will group before importing.",
3074
+ "NOT FOR: reading them (talonic_contracts_import).",
3075
+ "",
3076
+ "ARGS: `query` (filename contains).",
3077
+ "RETURNS: data[] { contract_key, in_price_baseline, documents[] { document_id, filename, import } }."
3078
+ ].join("\n");
3079
+ var candidatesInputSchema = { query: z.string().optional().describe("Filename contains.") };
3080
+ function handleCandidates(getToken, baseUrl, args) {
3081
+ return runTool(
3082
+ () => apiJson(getToken, baseUrl, "GET", "/v1/contracts/import/candidates", {
3083
+ params: { q: args.query }
3084
+ })
3085
+ );
3086
+ }
3087
+ var STATUS_DESCRIPTION = [
3088
+ "Where the read queue stands: counts by status (pending, running, done, failed) and the latest failures with their error.",
3089
+ "USE WHEN: after talonic_contracts_import, poll until pending and running are 0.",
3090
+ "NOT FOR: the contracts themselves (talonic_contracts_register).",
3091
+ "",
3092
+ "ARGS: none.",
3093
+ "RETURNS: { counts, failed[] { document_id, filename, error, attempts } }."
3094
+ ].join("\n");
3095
+ function handleImportStatus(getToken, baseUrl) {
3096
+ return runTool(() => apiJson(getToken, baseUrl, "GET", "/v1/contracts/import/status"));
3097
+ }
3098
+ var IMPORT_DESCRIPTION = [
3099
+ "Queue contract documents to be read; the platform reads them in the background (one model call each) and files each under its contract.",
3100
+ "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.",
3101
+ "NOT FOR: reading a contract again after cleaning (talonic_contracts_reread).",
3102
+ "",
3103
+ "ARGS: `all` or `document_ids`; with all: `query`, `contract_keys`, `only_priced`, `limit`, `dry_run`; with document_ids: `force` (read again even if read).",
3104
+ "RETURNS: all \u2192 { dry_run, contracts, documents, queued, skipped }; document_ids \u2192 { queued, skipped }. Then poll talonic_contracts_import_status."
3105
+ ].join("\n");
3106
+ var importInputSchema = {
3107
+ all: z.boolean().optional().describe("Queue every unread candidate (with the filters below)."),
3108
+ document_ids: z.array(z.string().uuid()).min(1).max(500).optional().describe("Workspace document ids to read."),
3109
+ query: z.string().optional().describe("all: only filenames containing this."),
3110
+ contract_keys: z.array(z.string()).max(2e3).optional().describe("all: only these contract keys."),
3111
+ only_priced: z.boolean().optional().describe("all: only keys Contract Pricing already models."),
3112
+ limit: z.number().int().min(1).max(2e4).optional().describe("all: queue at most this many documents."),
3113
+ dry_run: z.boolean().optional().describe("all: count only, queue nothing."),
3114
+ force: z.boolean().optional().describe("document_ids: read again even when already read.")
3115
+ };
3116
+ function handleImport(getToken, baseUrl, args) {
3117
+ if (!!args.all === !!args.document_ids?.length)
3118
+ return Promise.resolve(validationError("Pass either `all: true` or `document_ids`, not both."));
3119
+ if (args.all) {
3120
+ const { query, contract_keys, only_priced, limit: limit2, dry_run } = args;
3121
+ return runTool(
3122
+ () => apiJson(getToken, baseUrl, "POST", "/v1/contracts/import/all", {
3123
+ body: { query, contract_keys, only_priced, limit: limit2, dry_run }
3124
+ })
3125
+ );
3126
+ }
3127
+ return runTool(
3128
+ () => apiJson(getToken, baseUrl, "POST", "/v1/contracts/import", {
3129
+ body: { document_ids: args.document_ids, force: args.force }
3130
+ })
3131
+ );
3132
+ }
3133
+ var UPDATE_DOCUMENT_DESCRIPTION = [
3134
+ "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`).",
3135
+ "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).",
3136
+ "NOT FOR: moving all documents of a contract at once (talonic_contracts_merge).",
3137
+ "",
3138
+ "ARGS: `contract_id`, `document_row_id`, and one or more of `role`, `excluded`, `contract_key`; or `remove: true` alone.",
3139
+ "RETURNS: the contract the document ends up in, recomputed. A hand-set key and role survive re-reading."
3140
+ ].join("\n");
3141
+ var updateDocumentInputSchema = {
3142
+ contract_id: contractIdArg,
3143
+ document_row_id: rowIdArg,
3144
+ role: z.enum(ROLES).optional().describe("What the document is."),
3145
+ excluded: z.boolean().optional().describe("true = leave it out of the contract's terms."),
3146
+ contract_key: z.string().max(64).nullable().optional().describe("File under this key; null = back to the derived key."),
3147
+ remove: z.boolean().optional().describe("Take the document off the contract (the document stays in the workspace).")
3148
+ };
3149
+ function handleUpdateDocument(getToken, baseUrl, args) {
3150
+ const path = `/v1/contracts/${args.contract_id}/documents/${args.document_row_id}`;
3151
+ if (args.remove) {
3152
+ if (args.role !== void 0 || args.excluded !== void 0 || args.contract_key !== void 0)
3153
+ return Promise.resolve(validationError("`remove` goes alone."));
3154
+ return runTool(() => apiJson(getToken, baseUrl, "DELETE", path));
3155
+ }
3156
+ if (args.role === void 0 && args.excluded === void 0 && args.contract_key === void 0)
3157
+ return Promise.resolve(
3158
+ validationError("Nothing to change: pass role, excluded, contract_key or remove.")
3159
+ );
3160
+ return runTool(
3161
+ () => apiJson(getToken, baseUrl, "PUT", path, {
3162
+ body: { role: args.role, excluded: args.excluded, contract_key: args.contract_key }
3163
+ })
3164
+ );
3165
+ }
3166
+ var MERGE_DESCRIPTION = [
3167
+ "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.",
3168
+ "USE WHEN: two register rows are the same contract.",
3169
+ "NOT FOR: moving single documents (talonic_contracts_update_document).",
3170
+ "",
3171
+ "ARGS: `contract_id` (the one to empty), `into_key`.",
3172
+ "RETURNS: { moved, contract } \u2014 the contract under into_key, recomputed."
3173
+ ].join("\n");
3174
+ var mergeInputSchema = {
3175
+ contract_id: contractIdArg,
3176
+ into_key: z.string().min(1).max(64).describe("The key to move everything under.")
3177
+ };
3178
+ function handleMerge(getToken, baseUrl, args) {
3179
+ return runTool(
3180
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/${args.contract_id}/merge`, {
3181
+ body: { into_key: args.into_key }
3182
+ })
3183
+ );
3184
+ }
3185
+ var REREAD_DESCRIPTION = [
3186
+ "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.",
3187
+ "USE WHEN: a contract's terms look wrong and the documents are right.",
3188
+ "NOT FOR: documents never read (talonic_contracts_import).",
3189
+ "",
3190
+ "ARGS: `contract_id`, `document_row_id` (optional, all when omitted).",
3191
+ "RETURNS: { queued, skipped }. Then poll talonic_contracts_import_status."
3192
+ ].join("\n");
3193
+ var rereadInputSchema = {
3194
+ contract_id: contractIdArg,
3195
+ document_row_id: rowIdArg.optional()
3196
+ };
3197
+ function handleReread(getToken, baseUrl, args) {
3198
+ return runTool(
3199
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/${args.contract_id}/reread`, {
3200
+ body: args.document_row_id ? { document_row_id: args.document_row_id } : {}
3201
+ })
3202
+ );
3203
+ }
3204
+ var DECIDE_DESCRIPTION = [
3205
+ "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.",
3206
+ "USE WHEN: the user states the decision or it is confirmed by a document they point to. Never infer a termination on your own.",
3207
+ "NOT FOR: a termination letter already in the documents (it is read as a fact; check talonic_contracts_contract).",
3208
+ "",
3209
+ "ARGS: `contract_id`, `state`, `note` (say where the decision comes from).",
3210
+ "RETURNS: the contract, recomputed."
3211
+ ].join("\n");
3212
+ var decideInputSchema = {
3213
+ contract_id: contractIdArg,
3214
+ state: z.enum(DECISIONS),
3215
+ note: z.string().max(2e3).optional().describe("Source of the decision, e.g. 'K\xFCndigungsschreiben vom 12.01.2026'.")
3216
+ };
3217
+ function handleDecide(getToken, baseUrl, args) {
3218
+ return runTool(
3219
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/${args.contract_id}/decision`, {
3220
+ body: { state: args.state, note: args.note }
3221
+ })
3222
+ );
3223
+ }
3224
+ var KEY_DATE_DESCRIPTION = [
3225
+ "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.",
3226
+ "USE WHEN: the user confirms a date is taken care of.",
3227
+ "NOT FOR: changing the date itself (it follows the documents).",
3228
+ "",
3229
+ "ARGS: `key_date_id` (key_dates[].id from talonic_contracts_contract or id from talonic_contracts_upcoming), `handled`, `note`.",
3230
+ "RETURNS: { id, handled }."
3231
+ ].join("\n");
3232
+ var keyDateInputSchema = {
3233
+ key_date_id: z.string().uuid(),
3234
+ handled: z.boolean(),
3235
+ note: z.string().max(2e3).optional()
3236
+ };
3237
+ function handleKeyDate(getToken, baseUrl, args) {
3238
+ return runTool(
3239
+ () => apiJson(getToken, baseUrl, "POST", `/v1/contracts/key-dates/${args.key_date_id}`, {
3240
+ body: { handled: args.handled, note: args.note }
3241
+ })
3242
+ );
3243
+ }
3244
+ var SET_TERM_DESCRIPTION = [
3245
+ "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.",
3246
+ "USE WHEN: a term was missed or read wrong and you have the exact passage (talonic_get_document or talonic_search to find it).",
3247
+ "NOT FOR: guessing a value; decisions (talonic_contracts_decide).",
3248
+ "",
3249
+ "ARGS: `contract_id`, `document_row_id`, `field`, `value` (ISO date for dates; fraction for escalation_pct; months for *_months), `quote`.",
3250
+ "RETURNS: the contract, recomputed; an error naming the problem when the quote does not verify."
3251
+ ].join("\n");
3252
+ var setTermInputSchema = {
3253
+ contract_id: contractIdArg,
3254
+ document_row_id: rowIdArg,
3255
+ field: z.enum(TERMS),
3256
+ value: z.union([z.string(), z.number(), z.boolean()]),
3257
+ quote: z.string().min(3).max(2e3).describe("Copied character for character from the document.")
3258
+ };
3259
+ function handleSetTerm(getToken, baseUrl, args) {
3260
+ const { field, value, quote } = args;
3261
+ return runTool(
3262
+ () => apiJson(
3263
+ getToken,
3264
+ baseUrl,
3265
+ "POST",
3266
+ `/v1/contracts/${args.contract_id}/documents/${args.document_row_id}/terms`,
3267
+ { body: { field, value, quote } }
3268
+ )
3269
+ );
3270
+ }
3271
+ function registerContractsTools(server, getToken, baseUrl) {
3272
+ const tools = [
3273
+ [
3274
+ "talonic_contracts_register",
3275
+ "List contracts",
3276
+ REGISTER_DESCRIPTION,
3277
+ registerInputSchema,
3278
+ readOnly,
3279
+ (a) => handleRegister(getToken, baseUrl, a)
3280
+ ],
3281
+ [
3282
+ "talonic_contracts_contract",
3283
+ "Read one contract",
3284
+ CONTRACT_DESCRIPTION,
3285
+ contractInputSchema,
3286
+ readOnly,
3287
+ (a) => handleContract(getToken, baseUrl, a)
3288
+ ],
3289
+ [
3290
+ "talonic_contracts_issues",
3291
+ "Contracts to clean",
3292
+ ISSUES_DESCRIPTION,
3293
+ issuesInputSchema,
3294
+ readOnly,
3295
+ (a) => handleIssues(getToken, baseUrl, a)
3296
+ ],
3297
+ [
3298
+ "talonic_contracts_upcoming",
3299
+ "Upcoming contract dates",
3300
+ UPCOMING_DESCRIPTION,
3301
+ upcomingInputSchema,
3302
+ readOnly,
3303
+ (a) => handleUpcoming(getToken, baseUrl, a)
3304
+ ],
3305
+ [
3306
+ "talonic_contracts_import_candidates",
3307
+ "Unread contract documents",
3308
+ CANDIDATES_DESCRIPTION,
3309
+ candidatesInputSchema,
3310
+ readOnly,
3311
+ (a) => handleCandidates(getToken, baseUrl, a)
3312
+ ],
3313
+ [
3314
+ "talonic_contracts_import_status",
3315
+ "Contract read queue",
3316
+ STATUS_DESCRIPTION,
3317
+ {},
3318
+ readOnly,
3319
+ () => handleImportStatus(getToken, baseUrl)
3320
+ ],
3321
+ [
3322
+ "talonic_contracts_import",
3323
+ "Read contract documents",
3324
+ IMPORT_DESCRIPTION,
3325
+ importInputSchema,
3326
+ write(true),
3327
+ (a) => handleImport(getToken, baseUrl, a)
3328
+ ],
3329
+ [
3330
+ "talonic_contracts_update_document",
3331
+ "Fix a contract document",
3332
+ UPDATE_DOCUMENT_DESCRIPTION,
3333
+ updateDocumentInputSchema,
3334
+ write(false, true),
3335
+ (a) => handleUpdateDocument(getToken, baseUrl, a)
3336
+ ],
3337
+ [
3338
+ "talonic_contracts_merge",
3339
+ "Merge two contracts",
3340
+ MERGE_DESCRIPTION,
3341
+ mergeInputSchema,
3342
+ write(true, true),
3343
+ (a) => handleMerge(getToken, baseUrl, a)
3344
+ ],
3345
+ [
3346
+ "talonic_contracts_reread",
3347
+ "Read a contract again",
3348
+ REREAD_DESCRIPTION,
3349
+ rereadInputSchema,
3350
+ write(true),
3351
+ (a) => handleReread(getToken, baseUrl, a)
3352
+ ],
3353
+ [
3354
+ "talonic_contracts_decide",
3355
+ "Record a contract decision",
3356
+ DECIDE_DESCRIPTION,
3357
+ decideInputSchema,
3358
+ write(true),
3359
+ (a) => handleDecide(getToken, baseUrl, a)
3360
+ ],
3361
+ [
3362
+ "talonic_contracts_key_date",
3363
+ "Mark a key date handled",
3364
+ KEY_DATE_DESCRIPTION,
3365
+ keyDateInputSchema,
3366
+ write(true),
3367
+ (a) => handleKeyDate(getToken, baseUrl, a)
3368
+ ],
3369
+ [
3370
+ "talonic_contracts_set_term",
3371
+ "Set a contract term with its quote",
3372
+ SET_TERM_DESCRIPTION,
3373
+ setTermInputSchema,
3374
+ write(true),
3375
+ (a) => handleSetTerm(getToken, baseUrl, a)
3376
+ ]
3377
+ ];
3378
+ for (const [name, title, description, inputSchema11, annotations, handler] of tools) {
3379
+ server.registerTool(
3380
+ name,
3381
+ { title, description, inputSchema: inputSchema11, annotations: { title, ...annotations } },
3382
+ async (args) => handler(args)
3383
+ );
3384
+ }
3385
+ }
2948
3386
  var DEFAULT_BASE3 = "https://api.talonic.com";
2949
3387
  var TASK_STATUSES = ["available", "claimed", "submitted", "timed_out", "cancelled"];
2950
3388
  var taskId = z.string().uuid().describe("Agent task UUID.");
@@ -3388,7 +3826,6 @@ var MUTATING2 = {
3388
3826
  openWorldHint: false
3389
3827
  };
3390
3828
  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.";
3391
- 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";
3392
3829
  var DESCRIPTIONS2 = {
3393
3830
  list: [
3394
3831
  "List one External-mode app's decision tasks (runs parked for an outside agent to decide), newest first.",
@@ -3448,7 +3885,6 @@ var DESCRIPTIONS2 = {
3448
3885
  };
3449
3886
  function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3450
3887
  const invocable = options.invocable !== false;
3451
- const describe = (text) => invocable ? text : NOT_INVOCABLE_PREFIX + text;
3452
3888
  const metaFor = (key) => ({
3453
3889
  _meta: {
3454
3890
  ...widgetToolMeta(key),
@@ -3459,7 +3895,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3459
3895
  "talonic_list_decision_tasks",
3460
3896
  {
3461
3897
  title: "List Decision Tasks",
3462
- description: describe(DESCRIPTIONS2.list),
3898
+ description: DESCRIPTIONS2.list,
3463
3899
  inputSchema: listInput2,
3464
3900
  annotations: { title: "List Decision Tasks", ...READ_ONLY3 },
3465
3901
  ...metaFor("listDecisionTasks")
@@ -3470,7 +3906,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3470
3906
  "talonic_claim_decision_task",
3471
3907
  {
3472
3908
  title: "Claim Decision Task",
3473
- description: describe(DESCRIPTIONS2.claim),
3909
+ description: DESCRIPTIONS2.claim,
3474
3910
  inputSchema: idInput2,
3475
3911
  annotations: { title: "Claim Decision Task", ...MUTATING2 },
3476
3912
  ...metaFor("claimDecisionTask")
@@ -3481,7 +3917,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3481
3917
  "talonic_read_decision_package",
3482
3918
  {
3483
3919
  title: "Read Decision Package",
3484
- description: describe(DESCRIPTIONS2.package),
3920
+ description: DESCRIPTIONS2.package,
3485
3921
  inputSchema: packageInput,
3486
3922
  annotations: { title: "Read Decision Package", ...READ_ONLY3 },
3487
3923
  ...metaFor("readDecisionPackage")
@@ -3492,7 +3928,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3492
3928
  "talonic_heartbeat_decision_task",
3493
3929
  {
3494
3930
  title: "Heartbeat Decision Task",
3495
- description: describe(DESCRIPTIONS2.heartbeat),
3931
+ description: DESCRIPTIONS2.heartbeat,
3496
3932
  inputSchema: epochInput,
3497
3933
  annotations: { title: "Heartbeat Decision Task", ...MUTATING2 },
3498
3934
  ...metaFor("heartbeatDecisionTask")
@@ -3503,7 +3939,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3503
3939
  "talonic_submit_decision_task",
3504
3940
  {
3505
3941
  title: "Submit Decision Task",
3506
- description: describe(DESCRIPTIONS2.submit),
3942
+ description: DESCRIPTIONS2.submit,
3507
3943
  inputSchema: submitInput2,
3508
3944
  annotations: { title: "Submit Decision Task", ...MUTATING2 },
3509
3945
  ...metaFor("submitDecisionTask")
@@ -3514,7 +3950,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3514
3950
  "talonic_release_decision_task",
3515
3951
  {
3516
3952
  title: "Release Decision Task",
3517
- description: describe(DESCRIPTIONS2.release),
3953
+ description: DESCRIPTIONS2.release,
3518
3954
  inputSchema: epochInput,
3519
3955
  annotations: { title: "Release Decision Task", ...MUTATING2 },
3520
3956
  ...metaFor("releaseDecisionTask")
@@ -3525,7 +3961,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
3525
3961
  "talonic_fail_decision_task",
3526
3962
  {
3527
3963
  title: "Fail Decision Task",
3528
- description: describe(DESCRIPTIONS2.fail),
3964
+ description: DESCRIPTIONS2.fail,
3529
3965
  inputSchema: failInput,
3530
3966
  annotations: { title: "Fail Decision Task", ...MUTATING2 },
3531
3967
  ...metaFor("failDecisionTask")
@@ -3765,10 +4201,11 @@ function registerFieldTools(server, getToken, baseUrl) {
3765
4201
  server.registerTool(
3766
4202
  "talonic_list_fields",
3767
4203
  {
3768
- title: "List registry fields",
4204
+ title: "List Registry Fields",
3769
4205
  description: LIST_DESCRIPTION,
3770
4206
  inputSchema: listFieldsInputSchema,
3771
4207
  annotations: {
4208
+ title: "List Registry Fields",
3772
4209
  readOnlyHint: true,
3773
4210
  destructiveHint: false,
3774
4211
  idempotentHint: true,
@@ -3781,10 +4218,11 @@ function registerFieldTools(server, getToken, baseUrl) {
3781
4218
  server.registerTool(
3782
4219
  "talonic_get_field",
3783
4220
  {
3784
- title: "Get a field's concept card",
4221
+ title: "Get Field Concept Card",
3785
4222
  description: GET_DESCRIPTION,
3786
4223
  inputSchema: getFieldInputSchema,
3787
4224
  annotations: {
4225
+ title: "Get Field Concept Card",
3788
4226
  readOnlyHint: true,
3789
4227
  destructiveHint: false,
3790
4228
  idempotentHint: true,
@@ -3797,10 +4235,11 @@ function registerFieldTools(server, getToken, baseUrl) {
3797
4235
  server.registerTool(
3798
4236
  "talonic_field_values",
3799
4237
  {
3800
- title: "Read a field's values across documents",
4238
+ title: "Read Field Values",
3801
4239
  description: VALUES_DESCRIPTION,
3802
4240
  inputSchema: fieldValuesInputSchema,
3803
4241
  annotations: {
4242
+ title: "Read Field Values",
3804
4243
  readOnlyHint: true,
3805
4244
  destructiveHint: false,
3806
4245
  idempotentHint: true,
@@ -3935,10 +4374,11 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
3935
4374
  server.registerTool(
3936
4375
  "talonic_find_data",
3937
4376
  {
3938
- title: "Find the data behind a concept",
4377
+ title: "Find Data by Concept",
3939
4378
  description: FIND_DESCRIPTION,
3940
4379
  inputSchema: findDataInputSchema,
3941
4380
  annotations: {
4381
+ title: "Find Data by Concept",
3942
4382
  readOnlyHint: true,
3943
4383
  destructiveHint: false,
3944
4384
  idempotentHint: true,
@@ -3951,10 +4391,11 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
3951
4391
  server.registerTool(
3952
4392
  "talonic_list_agent_tools",
3953
4393
  {
3954
- title: "List the platform agent tools",
4394
+ title: "List Platform Agent Tools",
3955
4395
  description: LIST_TOOLS_DESCRIPTION,
3956
4396
  inputSchema: listAgentToolsInputSchema,
3957
4397
  annotations: {
4398
+ title: "List Platform Agent Tools",
3958
4399
  readOnlyHint: true,
3959
4400
  destructiveHint: false,
3960
4401
  idempotentHint: true,
@@ -3967,10 +4408,11 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
3967
4408
  server.registerTool(
3968
4409
  "talonic_invoke_agent_tool",
3969
4410
  {
3970
- title: "Invoke a platform agent tool",
4411
+ title: "Invoke Platform Agent Tool",
3971
4412
  description: INVOKE_DESCRIPTION,
3972
4413
  inputSchema: invokeAgentToolInputSchema,
3973
4414
  annotations: {
4415
+ title: "Invoke Platform Agent Tool",
3974
4416
  readOnlyHint: true,
3975
4417
  destructiveHint: false,
3976
4418
  idempotentHint: false,
@@ -4455,7 +4897,7 @@ function registerAskTools(server, getToken, baseUrl) {
4455
4897
 
4456
4898
  // package.json
4457
4899
  var package_default = {
4458
- version: "0.1.80"};
4900
+ version: "0.1.82"};
4459
4901
 
4460
4902
  // src/version.ts
4461
4903
  var VERSION = package_default.version;
@@ -4608,6 +5050,9 @@ function createServer(options) {
4608
5050
  if (options.includeAdminAgentTaskTools) {
4609
5051
  registerAdminAgentTaskTools(server, rawToken, baseUrl);
4610
5052
  }
5053
+ if (options.includeContractsTools) {
5054
+ registerContractsTools(server, rawToken, baseUrl);
5055
+ }
4611
5056
  registerSchemasResource(server, getTalonic);
4612
5057
  registerWebhooksResource(server, rawToken, baseUrl);
4613
5058
  registerWidgets(server);