@talonic/mcp 0.1.73 → 0.1.75

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
@@ -40,6 +40,19 @@ interface CreateServerOptions {
40
40
  * Stdio installs do not need this; they should use `apiKey` instead.
41
41
  */
42
42
  tokenProvider?: () => string;
43
+ /**
44
+ * Register the Talonic-internal growth analytics tools (superadmin-only).
45
+ * Callers set this ONLY after `probeGrowthAccess` passed for the session's
46
+ * credential — the platform re-checks the principal on every call, so this
47
+ * flag controls listing visibility, never access. Defaults to false.
48
+ */
49
+ includeGrowthTools?: boolean;
50
+ /**
51
+ * Register Talonic-internal cross-tenant Agent-task variants. Callers set
52
+ * this only after the platform access probe passes. The platform still
53
+ * re-authorizes every call; this flag controls listing visibility only.
54
+ */
55
+ includeAdminAgentTaskTools?: boolean;
43
56
  }
44
57
  /**
45
58
  * Build a Talonic MCP server, ready to be connected to a transport
package/dist/index.js CHANGED
@@ -1291,7 +1291,7 @@ var DESCRIPTION6 = [
1291
1291
  "NOT FOR: full text (use talonic_to_markdown) \xB7 extracted fields (use talonic_extract).",
1292
1292
  "BY NAME: if the user names a file, call talonic_search first to get its document_id, then call this.",
1293
1293
  "ARGS: document_id.",
1294
- "RETURNS: filename, pages, type_detected, language, and `status`. Status lifecycle: pending_upload -> queued -> extracting -> completed. Wait for `completed` before calling talonic_extract on a freshly uploaded doc. To read the document's text, call talonic_to_markdown with this id."
1294
+ "RETURNS: filename, pages, type_detected, language, and `status`. Status lifecycle: pending_upload -> uploading -> queued -> extracting -> completed. Wait for `completed` before calling talonic_extract on a freshly uploaded doc. Terminal failure statuses: ocr_failed, extraction_failed, error \u2014 stop polling and report the failure to the user if any of these appear. To read the document's text, call talonic_to_markdown with this id."
1295
1295
  ].join("\n");
1296
1296
  var inputSchema6 = {
1297
1297
  document_id: z.string().min(1).describe(
@@ -1625,7 +1625,7 @@ var DESCRIPTION10 = [
1625
1625
  "USE WHEN: the user wants to upload a document and you cannot pass it directly \u2014 hosted/sandboxed clients (ChatGPT, Claude.ai) or files too large for tool-call arguments.",
1626
1626
  "NOT FOR: a document already in the workspace (use its document_id) \xB7 a file already on a public URL (use file_url on talonic_extract).",
1627
1627
  "ARGS: filename (with extension).",
1628
- "RETURNS: upload_url, document_id, expires_at. After the user uploads, poll talonic_get_document on that document_id until status is 'completed', then call talonic_extract."
1628
+ "RETURNS: upload_url, document_id, expires_at. After the user uploads, poll talonic_get_document on that document_id until status is 'completed', then call talonic_extract. If status becomes ocr_failed, extraction_failed, or error, stop polling and report the failure to the user."
1629
1629
  ].join("\n");
1630
1630
  var inputSchema9 = {
1631
1631
  filename: z.string().min(1).describe(
@@ -1690,6 +1690,463 @@ function registerRequestUpload(server, getToken, baseUrl) {
1690
1690
  async (args) => handleRequestUpload(getToken, baseUrl, args)
1691
1691
  );
1692
1692
  }
1693
+ var DEFAULT_BASE = "https://api.talonic.com";
1694
+ var RANGES = ["7d", "30d", "90d"];
1695
+ async function growthGet(getToken, baseUrl, path, params) {
1696
+ try {
1697
+ const qs = new URLSearchParams();
1698
+ for (const [k, v] of Object.entries(params)) if (v !== void 0 && v !== "") qs.set(k, v);
1699
+ const url = `${baseUrl ?? DEFAULT_BASE}/v1/growth/${path}${qs.size ? `?${qs}` : ""}`;
1700
+ const res = await fetch(url, {
1701
+ headers: { Authorization: `Bearer ${getToken()}`, Accept: "application/json" }
1702
+ });
1703
+ if (res.status === 403) {
1704
+ return toolError(
1705
+ new Error(
1706
+ "Talonic growth analytics require an active superadmin account. Sign in to the connector with your Talonic staff account (or use a superadmin-created API key)."
1707
+ )
1708
+ );
1709
+ }
1710
+ if (!res.ok) {
1711
+ const body = await res.text().catch(() => "");
1712
+ return toolError(
1713
+ new Error(`Talonic API error: HTTP ${res.status}${body ? ` \u2014 ${body}` : ""}`)
1714
+ );
1715
+ }
1716
+ return jsonOk(await res.json());
1717
+ } catch (err) {
1718
+ return toolError(err);
1719
+ }
1720
+ }
1721
+ var rangeArg = z.enum(RANGES).optional().describe("Trailing window (default 30d).");
1722
+ var FUNNEL_DESCRIPTION = [
1723
+ "Read Talonic's agentic product funnel: WAEW (weekly active extracting workspaces \u2014 the North Star),",
1724
+ "time-to-first-extraction p50/p90 + 24h activation rate, W2/W4 creation-cohort retention, and",
1725
+ "acquisition by surface (claude_ai, cursor, raw_api, ...).",
1726
+ "",
1727
+ "USE WHEN: asked about WAEW, activation, retention, or which surfaces drive extractions.",
1728
+ "INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
1729
+ "ARGS: range (optional: 7d | 30d | 90d, default 30d).",
1730
+ "RETURNS: { configured, rangeDays, waew, ttfe, retention[], bySurface[] } \u2014 configured:false means PostHog is unwired, not zero usage."
1731
+ ].join("\n");
1732
+ var FUNNELS_DESCRIPTION = [
1733
+ "Read Talonic's website conversion funnels: Platform registration (Visit \u2192 Sign-up click \u2192 Account created \u2192 Activated)",
1734
+ "and Sales call booking (Visit \u2192 Book-demo click \u2192 Contact page \u2192 Demo booked).",
1735
+ "",
1736
+ "USE WHEN: asked about signups, activation counts, demo bookings, or website conversion.",
1737
+ "INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
1738
+ "ARGS: range (optional: 7d | 30d | 90d, default 30d).",
1739
+ "RETURNS: { rangeDays, funnels[] } \u2014 each stage carries { count, pending }; pending:true means that stage's source is not wired yet, not zero."
1740
+ ].join("\n");
1741
+ var TRAFFIC_DESCRIPTION = [
1742
+ "Read talonic.com traffic: visitors, pageviews, top pages, and referrers split into AI assistants",
1743
+ "(ChatGPT, Claude, Perplexity, ...) vs other domains.",
1744
+ "",
1745
+ "USE WHEN: asked about website traffic, top pages, or how many visitors AI assistants refer.",
1746
+ "INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
1747
+ "ARGS: range (optional: 7d | 30d | 90d, default 30d).",
1748
+ "RETURNS: { configured, visitors, pageviews, topPages[], topReferrers[], aiReferrers[] }."
1749
+ ].join("\n");
1750
+ var TOOLS_USAGE_DESCRIPTION = [
1751
+ "Read anonymous visitor behavior on the free tools at talonic.com/tools: views, attempt/success/bounce",
1752
+ "rates, dwell, CTA clicks, per-tool leaderboard, and country/device/acquisition splits.",
1753
+ "",
1754
+ "USE WHEN: asked how the free tools perform, which tools convert, or where tool visitors come from.",
1755
+ "INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
1756
+ "ARGS: all optional \u2014 range (today | 7d | 30d | 90d | all, default 30d), tool (slug), category, country (ISO code), device (desktop | mobile | tablet), source (utm/referrer key), funnel_stage (attempted | succeeded | downloaded | cta).",
1757
+ "RETURNS: the Tools Usage dashboard payload: totals, rates, tools[] leaderboard, breakdowns, trend. Rates are ratios of independent counts, not per-visitor funnels."
1758
+ ].join("\n");
1759
+ var toolsUsageInput = {
1760
+ range: z.enum(["today", "7d", "30d", "90d", "all"]).optional().describe("Window (default 30d)."),
1761
+ tool: z.string().optional().describe("Restrict to one tool slug (e.g. 'pdf-to-csv')."),
1762
+ category: z.string().optional().describe("Restrict to a tool category."),
1763
+ country: z.string().optional().describe("Restrict to a visitor country (ISO code, e.g. 'DE')."),
1764
+ device: z.string().optional().describe("Restrict to a device type: desktop, mobile, or tablet."),
1765
+ source: z.string().optional().describe("Restrict to an acquisition source (UTM value or referrer host)."),
1766
+ funnel_stage: z.enum(["attempted", "succeeded", "downloaded", "cta"]).optional().describe("Keep only tools with at least one event at this funnel stage.")
1767
+ };
1768
+ async function handleGrowthFunnel(getToken, baseUrl, args) {
1769
+ return growthGet(getToken, baseUrl, "funnel", { range: args.range });
1770
+ }
1771
+ async function handleGrowthFunnels(getToken, baseUrl, args) {
1772
+ return growthGet(getToken, baseUrl, "funnels", { range: args.range });
1773
+ }
1774
+ async function handleGrowthTraffic(getToken, baseUrl, args) {
1775
+ return growthGet(getToken, baseUrl, "traffic", { range: args.range });
1776
+ }
1777
+ async function handleGrowthToolsUsage(getToken, baseUrl, args) {
1778
+ return growthGet(getToken, baseUrl, "tools-usage", {
1779
+ range: args.range,
1780
+ tool: args.tool,
1781
+ category: args.category,
1782
+ country: args.country,
1783
+ device: args.device,
1784
+ source: args.source,
1785
+ funnelStage: args.funnel_stage
1786
+ });
1787
+ }
1788
+ var READ_ONLY = {
1789
+ readOnlyHint: true,
1790
+ destructiveHint: false,
1791
+ openWorldHint: false
1792
+ };
1793
+ function registerGrowthTools(server, getToken, baseUrl) {
1794
+ server.registerTool(
1795
+ "talonic_growth_funnel",
1796
+ {
1797
+ title: "Growth: Product Funnel",
1798
+ description: FUNNEL_DESCRIPTION,
1799
+ inputSchema: { range: rangeArg },
1800
+ annotations: { title: "Growth: Product Funnel", ...READ_ONLY }
1801
+ },
1802
+ async (args) => handleGrowthFunnel(getToken, baseUrl, args)
1803
+ );
1804
+ server.registerTool(
1805
+ "talonic_growth_funnels",
1806
+ {
1807
+ title: "Growth: Conversion Funnels",
1808
+ description: FUNNELS_DESCRIPTION,
1809
+ inputSchema: { range: rangeArg },
1810
+ annotations: { title: "Growth: Conversion Funnels", ...READ_ONLY }
1811
+ },
1812
+ async (args) => handleGrowthFunnels(getToken, baseUrl, args)
1813
+ );
1814
+ server.registerTool(
1815
+ "talonic_growth_traffic",
1816
+ {
1817
+ title: "Growth: Website Traffic",
1818
+ description: TRAFFIC_DESCRIPTION,
1819
+ inputSchema: { range: rangeArg },
1820
+ annotations: { title: "Growth: Website Traffic", ...READ_ONLY }
1821
+ },
1822
+ async (args) => handleGrowthTraffic(getToken, baseUrl, args)
1823
+ );
1824
+ server.registerTool(
1825
+ "talonic_growth_tools_usage",
1826
+ {
1827
+ title: "Growth: Free-Tools Usage",
1828
+ description: TOOLS_USAGE_DESCRIPTION,
1829
+ inputSchema: toolsUsageInput,
1830
+ annotations: { title: "Growth: Free-Tools Usage", ...READ_ONLY }
1831
+ },
1832
+ async (args) => handleGrowthToolsUsage(getToken, baseUrl, args)
1833
+ );
1834
+ }
1835
+ var DEFAULT_BASE2 = "https://api.talonic.com";
1836
+ var TASK_STATUSES = ["available", "claimed", "submitted", "timed_out", "cancelled"];
1837
+ var taskId = z.string().uuid().describe("Agent task UUID.");
1838
+ var executionEpoch = z.number().int().min(1).max(2147483647).describe("Execution epoch returned by the successful claim. Stale epochs are rejected.");
1839
+ var status = z.enum(TASK_STATUSES).optional().describe("Optional task-status filter.");
1840
+ var limit = z.number().int().min(1).max(100).optional().describe("Page size (default 50).");
1841
+ var cursor = z.string().min(1).optional().describe("Opaque cursor from pagination.next_cursor.");
1842
+ var outputValue = z.object({
1843
+ value: z.json().describe("JSON value matching the field's declared data type."),
1844
+ confidence: z.number().min(0).max(1).optional().describe("Optional confidence from 0 to 1."),
1845
+ reasoning: z.string().max(4e3).optional().describe("Optional concise reasoning for this field, up to 4,000 characters.")
1846
+ });
1847
+ var outputs = z.record(z.string().min(1), outputValue).describe("Output field key to { value, confidence?, reasoning? }. Use only declared fields.");
1848
+ var listInput = { status, limit, cursor };
1849
+ var idInput = { task_id: taskId };
1850
+ var heartbeatInput = { task_id: taskId, execution_epoch: executionEpoch };
1851
+ var submitInput = {
1852
+ task_id: taskId,
1853
+ execution_epoch: executionEpoch,
1854
+ outputs,
1855
+ summary: z.string().max(4e3).optional().describe("Optional result summary, up to 4,000 characters.")
1856
+ };
1857
+ var adminCustomerId = z.string().uuid().describe("Explicit customer/workspace UUID. Payload calls never accept 'all'.");
1858
+ var adminReason = z.string().min(1).max(1e3).describe("Human-readable reason recorded with the cross-tenant access.");
1859
+ var adminTotp = z.string().regex(/^\d{6}$/, "TOTP code must contain exactly 6 digits").describe("Fresh 6-digit TOTP code for step-up authorization.");
1860
+ var adminPayloadAccessInput = {
1861
+ customer_id: adminCustomerId,
1862
+ reason: adminReason,
1863
+ totp_code: adminTotp
1864
+ };
1865
+ function apiUrl(baseUrl, path, query) {
1866
+ const base = (baseUrl ?? DEFAULT_BASE2).replace(/\/$/, "");
1867
+ const url = new URL(`${base}${path}`);
1868
+ for (const [key, value] of Object.entries(query ?? {})) {
1869
+ if (value !== void 0 && value !== "") url.searchParams.set(key, String(value));
1870
+ }
1871
+ return url.toString();
1872
+ }
1873
+ async function agentTaskRequest(getToken, baseUrl, request) {
1874
+ try {
1875
+ const response = await fetch(apiUrl(baseUrl, request.path, request.query), {
1876
+ method: request.method ?? "GET",
1877
+ headers: {
1878
+ Authorization: `Bearer ${getToken()}`,
1879
+ Accept: "application/json",
1880
+ ...request.body === void 0 ? {} : { "Content-Type": "application/json" },
1881
+ ...request.headers
1882
+ },
1883
+ ...request.body === void 0 ? {} : { body: JSON.stringify(request.body) }
1884
+ });
1885
+ if (!response.ok) {
1886
+ const body = await response.text().catch(() => "");
1887
+ return toolError(
1888
+ new Error(`Talonic API error: HTTP ${response.status}${body ? ` \u2014 ${body}` : ""}`)
1889
+ );
1890
+ }
1891
+ return jsonOk(await response.json());
1892
+ } catch (error) {
1893
+ return toolError(error);
1894
+ }
1895
+ }
1896
+ function listQuery(args) {
1897
+ return { status: args.status, limit: args.limit, cursor: args.cursor };
1898
+ }
1899
+ function adminHeaders(args) {
1900
+ return {
1901
+ "x-talonic-reason": args.reason,
1902
+ "x-step-up-code": args.totp_code
1903
+ };
1904
+ }
1905
+ function handleListAgentTasks(getToken, baseUrl, args) {
1906
+ return agentTaskRequest(getToken, baseUrl, {
1907
+ path: "/v1/agent-tasks",
1908
+ query: listQuery(args)
1909
+ });
1910
+ }
1911
+ function handleGetAgentTask(getToken, baseUrl, args) {
1912
+ return agentTaskRequest(getToken, baseUrl, {
1913
+ path: `/v1/agent-tasks/${encodeURIComponent(args.task_id)}`
1914
+ });
1915
+ }
1916
+ function handleClaimAgentTask(getToken, baseUrl, args) {
1917
+ return agentTaskRequest(getToken, baseUrl, {
1918
+ method: "POST",
1919
+ path: `/v1/agent-tasks/${encodeURIComponent(args.task_id)}/claim`
1920
+ });
1921
+ }
1922
+ function handleHeartbeatAgentTask(getToken, baseUrl, args) {
1923
+ return agentTaskRequest(getToken, baseUrl, {
1924
+ method: "POST",
1925
+ path: `/v1/agent-tasks/${encodeURIComponent(args.task_id)}/heartbeat`,
1926
+ body: { execution_epoch: args.execution_epoch }
1927
+ });
1928
+ }
1929
+ function handleSubmitAgentTask(getToken, baseUrl, args) {
1930
+ return agentTaskRequest(getToken, baseUrl, {
1931
+ method: "POST",
1932
+ path: `/v1/agent-tasks/${encodeURIComponent(args.task_id)}/submit`,
1933
+ body: {
1934
+ execution_epoch: args.execution_epoch,
1935
+ outputs: args.outputs,
1936
+ ...args.summary === void 0 ? {} : { summary: args.summary }
1937
+ }
1938
+ });
1939
+ }
1940
+ function handleAdminListAgentTasks(getToken, baseUrl, args) {
1941
+ return agentTaskRequest(getToken, baseUrl, {
1942
+ path: "/v1/agent-tasks/admin/tasks",
1943
+ query: { customerId: args.customer_id ?? "all", ...listQuery(args) }
1944
+ });
1945
+ }
1946
+ function handleAdminGetAgentTask(getToken, baseUrl, args) {
1947
+ return agentTaskRequest(getToken, baseUrl, {
1948
+ path: `/v1/agent-tasks/admin/tasks/${encodeURIComponent(args.task_id)}`,
1949
+ query: { customerId: args.customer_id },
1950
+ headers: adminHeaders(args)
1951
+ });
1952
+ }
1953
+ function handleAdminClaimAgentTask(getToken, baseUrl, args) {
1954
+ return agentTaskRequest(getToken, baseUrl, {
1955
+ method: "POST",
1956
+ path: `/v1/agent-tasks/admin/tasks/${encodeURIComponent(args.task_id)}/claim`,
1957
+ query: { customerId: args.customer_id },
1958
+ headers: adminHeaders(args)
1959
+ });
1960
+ }
1961
+ function handleAdminHeartbeatAgentTask(getToken, baseUrl, args) {
1962
+ return agentTaskRequest(getToken, baseUrl, {
1963
+ method: "POST",
1964
+ path: `/v1/agent-tasks/admin/tasks/${encodeURIComponent(args.task_id)}/heartbeat`,
1965
+ query: { customerId: args.customer_id },
1966
+ headers: adminHeaders(args),
1967
+ body: { execution_epoch: args.execution_epoch }
1968
+ });
1969
+ }
1970
+ function handleAdminSubmitAgentTask(getToken, baseUrl, args) {
1971
+ return agentTaskRequest(getToken, baseUrl, {
1972
+ method: "POST",
1973
+ path: `/v1/agent-tasks/admin/tasks/${encodeURIComponent(args.task_id)}/submit`,
1974
+ query: { customerId: args.customer_id },
1975
+ headers: adminHeaders(args),
1976
+ body: {
1977
+ execution_epoch: args.execution_epoch,
1978
+ outputs: args.outputs,
1979
+ ...args.summary === void 0 ? {} : { summary: args.summary }
1980
+ }
1981
+ });
1982
+ }
1983
+ var READ_ONLY2 = {
1984
+ readOnlyHint: true,
1985
+ destructiveHint: false,
1986
+ openWorldHint: false
1987
+ };
1988
+ var MUTATING = {
1989
+ readOnlyHint: false,
1990
+ destructiveHint: false,
1991
+ openWorldHint: false
1992
+ };
1993
+ var DESCRIPTIONS = {
1994
+ list: [
1995
+ "List Agent-stage tasks visible to this Talonic workspace credential.",
1996
+ "",
1997
+ "USE WHEN: looking for external-agent work to process; begin with status 'available'.",
1998
+ "NOT FOR: reading the immutable task payload (use talonic_get_agent_task) or taking a lease (use talonic_claim_agent_task).",
1999
+ "ARGS: optional status, limit, and cursor. RETURNS: metadata only plus pagination.next_cursor."
2000
+ ].join("\n"),
2001
+ get: [
2002
+ "Fetch one Agent-stage task's immutable input snapshot, instructions, and declared output contract. This disclosure is audited.",
2003
+ "",
2004
+ "USE WHEN: inspecting a listed task before deciding whether to process it.",
2005
+ "NOT FOR: acquiring the task (use talonic_claim_agent_task) or returning results (use talonic_submit_agent_task).",
2006
+ "ARGS: task_id. RETURNS: metadata, input_snapshot, output_contract, instructions, and timeout_fallthrough."
2007
+ ].join("\n"),
2008
+ claim: [
2009
+ "Claim an available Agent-stage task, or reclaim it after its lease expires.",
2010
+ "",
2011
+ "USE WHEN: ready to process a task. Save the returned execution_epoch and lease_expires_at.",
2012
+ "NOT FOR: merely inspecting work (use talonic_get_agent_task) or extending an active lease (use talonic_heartbeat_agent_task).",
2013
+ "A conflicting live claim returns HTTP 409. A successful claim returns the task payload."
2014
+ ].join("\n"),
2015
+ heartbeat: [
2016
+ "Extend the lease on a claimed Agent-stage task.",
2017
+ "",
2018
+ "USE WHEN: processing may continue past lease_expires_at; heartbeat before expiry using the epoch from claim.",
2019
+ "NOT FOR: acquiring a task (use talonic_claim_agent_task) or submitting finished outputs (use talonic_submit_agent_task).",
2020
+ "ARGS: task_id and execution_epoch. Stale or foreign claims return HTTP 409."
2021
+ ].join("\n"),
2022
+ submit: [
2023
+ "Submit declared output fields for a claimed Agent-stage task and resume the parked document.",
2024
+ "",
2025
+ "USE WHEN: processing is complete and every required output in output_contract is ready.",
2026
+ "NOT FOR: undeclared fields or partial lease maintenance (use talonic_heartbeat_agent_task).",
2027
+ "ARGS: task_id, execution_epoch, outputs keyed exactly by declared field key, and optional summary. The platform validates all fields and types transactionally before writing anything."
2028
+ ].join("\n")
2029
+ };
2030
+ function registerAgentTaskTools(server, getToken, baseUrl) {
2031
+ server.registerTool(
2032
+ "talonic_list_agent_tasks",
2033
+ {
2034
+ title: "List Agent Tasks",
2035
+ description: DESCRIPTIONS.list,
2036
+ inputSchema: listInput,
2037
+ annotations: { title: "List Agent Tasks", ...READ_ONLY2 }
2038
+ },
2039
+ async (args) => handleListAgentTasks(getToken, baseUrl, args)
2040
+ );
2041
+ server.registerTool(
2042
+ "talonic_get_agent_task",
2043
+ {
2044
+ title: "Get Agent Task",
2045
+ description: DESCRIPTIONS.get,
2046
+ inputSchema: idInput,
2047
+ annotations: { title: "Get Agent Task", ...READ_ONLY2 }
2048
+ },
2049
+ async (args) => handleGetAgentTask(getToken, baseUrl, args)
2050
+ );
2051
+ server.registerTool(
2052
+ "talonic_claim_agent_task",
2053
+ {
2054
+ title: "Claim Agent Task",
2055
+ description: DESCRIPTIONS.claim,
2056
+ inputSchema: idInput,
2057
+ annotations: { title: "Claim Agent Task", ...MUTATING }
2058
+ },
2059
+ async (args) => handleClaimAgentTask(getToken, baseUrl, args)
2060
+ );
2061
+ server.registerTool(
2062
+ "talonic_heartbeat_agent_task",
2063
+ {
2064
+ title: "Heartbeat Agent Task",
2065
+ description: DESCRIPTIONS.heartbeat,
2066
+ inputSchema: heartbeatInput,
2067
+ annotations: { title: "Heartbeat Agent Task", ...MUTATING }
2068
+ },
2069
+ async (args) => handleHeartbeatAgentTask(getToken, baseUrl, args)
2070
+ );
2071
+ server.registerTool(
2072
+ "talonic_submit_agent_task",
2073
+ {
2074
+ title: "Submit Agent Task",
2075
+ description: DESCRIPTIONS.submit,
2076
+ inputSchema: submitInput,
2077
+ annotations: { title: "Submit Agent Task", ...MUTATING }
2078
+ },
2079
+ async (args) => handleSubmitAgentTask(getToken, baseUrl, args)
2080
+ );
2081
+ }
2082
+ var adminIdInput = { task_id: taskId, ...adminPayloadAccessInput };
2083
+ var adminHeartbeatInput = {
2084
+ task_id: taskId,
2085
+ execution_epoch: executionEpoch,
2086
+ ...adminPayloadAccessInput
2087
+ };
2088
+ var adminSubmitInput = {
2089
+ task_id: taskId,
2090
+ execution_epoch: executionEpoch,
2091
+ outputs,
2092
+ summary: z.string().max(4e3).optional(),
2093
+ ...adminPayloadAccessInput
2094
+ };
2095
+ function registerAdminAgentTaskTools(server, getToken, baseUrl) {
2096
+ server.registerTool(
2097
+ "talonic_admin_list_agent_tasks",
2098
+ {
2099
+ title: "Admin: List Agent Tasks",
2100
+ description: "INTERNAL: list Agent-task metadata across all tenants or one named tenant. NOT FOR payload data; use talonic_admin_get_agent_task with an explicit tenant, reason, and TOTP code.",
2101
+ inputSchema: {
2102
+ customer_id: z.union([z.string().uuid(), z.literal("all")]).optional().describe("Tenant UUID, or 'all' (default) for cross-tenant metadata."),
2103
+ ...listInput
2104
+ },
2105
+ annotations: { title: "Admin: List Agent Tasks", ...READ_ONLY2 }
2106
+ },
2107
+ async (args) => handleAdminListAgentTasks(getToken, baseUrl, args)
2108
+ );
2109
+ server.registerTool(
2110
+ "talonic_admin_get_agent_task",
2111
+ {
2112
+ title: "Admin: Get Agent Task",
2113
+ description: "INTERNAL: fetch one Agent-task payload for an explicit tenant. This audited disclosure requires interactive OAuth, a reason, and fresh TOTP. NOT FOR cross-tenant metadata listing.",
2114
+ inputSchema: adminIdInput,
2115
+ annotations: { title: "Admin: Get Agent Task", ...READ_ONLY2 }
2116
+ },
2117
+ async (args) => handleAdminGetAgentTask(getToken, baseUrl, args)
2118
+ );
2119
+ server.registerTool(
2120
+ "talonic_admin_claim_agent_task",
2121
+ {
2122
+ title: "Admin: Claim Agent Task",
2123
+ description: "INTERNAL: claim or reclaim one Agent task in an explicit tenant. Requires interactive OAuth, reason, and fresh TOTP. NOT FOR metadata-only access.",
2124
+ inputSchema: adminIdInput,
2125
+ annotations: { title: "Admin: Claim Agent Task", ...MUTATING }
2126
+ },
2127
+ async (args) => handleAdminClaimAgentTask(getToken, baseUrl, args)
2128
+ );
2129
+ server.registerTool(
2130
+ "talonic_admin_heartbeat_agent_task",
2131
+ {
2132
+ title: "Admin: Heartbeat Agent Task",
2133
+ description: "INTERNAL: extend one claimed Agent-task lease in an explicit tenant. Requires interactive OAuth, reason, and fresh TOTP. NOT FOR acquiring a task.",
2134
+ inputSchema: adminHeartbeatInput,
2135
+ annotations: { title: "Admin: Heartbeat Agent Task", ...MUTATING }
2136
+ },
2137
+ async (args) => handleAdminHeartbeatAgentTask(getToken, baseUrl, args)
2138
+ );
2139
+ server.registerTool(
2140
+ "talonic_admin_submit_agent_task",
2141
+ {
2142
+ title: "Admin: Submit Agent Task",
2143
+ description: "INTERNAL: submit declared outputs for one claimed Agent task in an explicit tenant. Requires interactive OAuth, reason, and fresh TOTP. NOT FOR undeclared fields.",
2144
+ inputSchema: adminSubmitInput,
2145
+ annotations: { title: "Admin: Submit Agent Task", ...MUTATING }
2146
+ },
2147
+ async (args) => handleAdminSubmitAgentTask(getToken, baseUrl, args)
2148
+ );
2149
+ }
1693
2150
  var DESCRIPTION11 = [
1694
2151
  "Get the OCR-converted markdown text of a document.",
1695
2152
  "",
@@ -1797,7 +2254,7 @@ function registerToMarkdown(server, getTalonic) {
1797
2254
 
1798
2255
  // package.json
1799
2256
  var package_default = {
1800
- version: "0.1.73"};
2257
+ version: "0.1.75"};
1801
2258
 
1802
2259
  // src/version.ts
1803
2260
  var VERSION = package_default.version;
@@ -1889,6 +2346,9 @@ function createServer(options) {
1889
2346
  "with that id \u2014 do not ask the user for an id.",
1890
2347
  "talonic_search matches LITERAL keywords: query with one short singular term or an",
1891
2348
  "exact filename, never a sentence; on an empty result retry with a shorter keyword.",
2349
+ "For Agent-stage work, follow list -> get -> claim -> heartbeat while needed ->",
2350
+ "submit. Preserve the execution_epoch from claim and return only fields declared",
2351
+ "in the task output_contract; never continue after a lease or epoch conflict.",
1892
2352
  "Prefer acting over explaining."
1893
2353
  ].join(" ")
1894
2354
  }
@@ -1912,6 +2372,13 @@ function createServer(options) {
1912
2372
  registerGetPricing(server, getTalonic);
1913
2373
  registerGetUsage(server, getTalonic);
1914
2374
  registerRequestUpload(server, getToken, baseUrl);
2375
+ registerAgentTaskTools(server, getToken, baseUrl);
2376
+ if (options.includeGrowthTools) {
2377
+ registerGrowthTools(server, getToken, baseUrl);
2378
+ }
2379
+ if (options.includeAdminAgentTaskTools) {
2380
+ registerAdminAgentTaskTools(server, getToken, baseUrl);
2381
+ }
1915
2382
  registerSchemasResource(server, getTalonic);
1916
2383
  registerWebhooksResource(server, getToken, baseUrl);
1917
2384
  registerWidgets(server);