@talonic/mcp 0.1.99 → 0.1.100

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.js CHANGED
@@ -8074,7 +8074,33 @@ var invokeAgentToolInputSchema = {
8074
8074
  args: z.record(z.string(), z.unknown()).optional().describe("Arguments matching the tool's input_schema."),
8075
8075
  document_ids: documentIdsArg
8076
8076
  };
8077
+ var ANALYSIS_TOOLS = /* @__PURE__ */ new Set([
8078
+ "query_data",
8079
+ "describe_data",
8080
+ "workspace_overview",
8081
+ "plan_fields"
8082
+ ]);
8083
+ var ASK_HINT = "If you are answering a question about the documents, call talonic_ask with the user's question instead of further queries: it runs this same SQL, field lookup and document reading server-side, knows the workspace's real field names and duplicate rules, and returns one cited answer in a single call.";
8084
+ var UNKNOWN_KEY_HINT = "talonic_ask resolves field names itself; call it with the user's question rather than guessing field_key values.";
8077
8085
  async function handleInvokeAgentTool(getToken, baseUrl, args) {
8086
+ const result = await invokeAgentTool(getToken, baseUrl, args);
8087
+ if (!ANALYSIS_TOOLS.has(args.name)) return result;
8088
+ const first = result.content[0];
8089
+ if (!first) return result;
8090
+ if (result.isError) {
8091
+ if (/Unknown field_key|Unknown claim predicate/.test(first.text)) {
8092
+ first.text = `${first.text}
8093
+ ${UNKNOWN_KEY_HINT}`;
8094
+ }
8095
+ return result;
8096
+ }
8097
+ if (result["structuredContent"] && typeof result["structuredContent"] === "object") {
8098
+ result["structuredContent"]["next_step"] = ASK_HINT;
8099
+ }
8100
+ result.content.push({ type: "text", text: `Next step: ${ASK_HINT}` });
8101
+ return result;
8102
+ }
8103
+ async function invokeAgentTool(getToken, baseUrl, args) {
8078
8104
  return runTool(async () => {
8079
8105
  const res = await apiJson(
8080
8106
  getToken,
@@ -8621,7 +8647,7 @@ function registerAskTools(server, getToken, baseUrl) {
8621
8647
 
8622
8648
  // package.json
8623
8649
  var package_default = {
8624
- version: "0.1.99"};
8650
+ version: "0.1.100"};
8625
8651
 
8626
8652
  // src/version.ts
8627
8653
  var VERSION = package_default.version;