@axonity-ai/mcp 0.1.0 → 0.3.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.
Files changed (44) hide show
  1. package/README.md +172 -24
  2. package/dist/client.d.ts +11 -2
  3. package/dist/client.js +28 -10
  4. package/dist/client.js.map +1 -1
  5. package/dist/errors.d.ts +53 -10
  6. package/dist/errors.js +163 -19
  7. package/dist/errors.js.map +1 -1
  8. package/dist/index.d.ts +21 -0
  9. package/dist/index.js +135 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/tools/company.d.ts +16 -0
  12. package/dist/tools/company.js +81 -0
  13. package/dist/tools/company.js.map +1 -0
  14. package/dist/tools/conventions.d.ts +10 -4
  15. package/dist/tools/conventions.js +389 -23
  16. package/dist/tools/conventions.js.map +1 -1
  17. package/dist/tools/credentials.d.ts +34 -0
  18. package/dist/tools/credentials.js +106 -0
  19. package/dist/tools/credentials.js.map +1 -0
  20. package/dist/tools/extras.d.ts +14 -5
  21. package/dist/tools/extras.js +85 -40
  22. package/dist/tools/extras.js.map +1 -1
  23. package/dist/tools/promptPlacement.d.ts +15 -0
  24. package/dist/tools/promptPlacement.js +99 -0
  25. package/dist/tools/promptPlacement.js.map +1 -0
  26. package/dist/tools/register.d.ts +67 -10
  27. package/dist/tools/register.js +77 -22
  28. package/dist/tools/register.js.map +1 -1
  29. package/dist/tools/runs.d.ts +14 -0
  30. package/dist/tools/runs.js +103 -0
  31. package/dist/tools/runs.js.map +1 -0
  32. package/dist/tools/triggers.d.ts +13 -0
  33. package/dist/tools/triggers.js +128 -0
  34. package/dist/tools/triggers.js.map +1 -0
  35. package/dist/tools/validation.d.ts +13 -0
  36. package/dist/tools/validation.js +116 -0
  37. package/dist/tools/validation.js.map +1 -0
  38. package/dist/tools/versions.d.ts +37 -0
  39. package/dist/tools/versions.js +104 -0
  40. package/dist/tools/versions.js.map +1 -0
  41. package/dist/tools/workflowMutations.d.ts +22 -0
  42. package/dist/tools/workflowMutations.js +118 -23
  43. package/dist/tools/workflowMutations.js.map +1 -1
  44. package/package.json +2 -2
@@ -1,20 +1,17 @@
1
1
  /**
2
- * Secondary MCP tools (epic #652 C5): personas (agent-scoped), connectors
3
- * (a tool subtype), and attaching memory to a target.
2
+ * Secondary MCP tools: the agent-scoped persona create/read (personas
3
+ * themselves are a full generic entity — see index.ts — but creation and the
4
+ * by-agent read have no equivalent generic route), connectors (a tool
5
+ * subtype), attaching memory to a target, and a few standalone one-offs.
4
6
  *
5
7
  * These use routes with shapes that don't fit the generic entity registrar:
6
- * personas are 1:1 with an agent (no standalone list), connectors are a tool
7
- * with `type: "connector"` and MUST NOT carry real credentials, and attach is a
8
- * path-only link.
8
+ * a persona is created only through its agent, connectors are a tool with
9
+ * `type: "connector"` and MUST NOT carry real credentials, and attach/detach
10
+ * is a path-only link.
9
11
  */
10
12
  import { z } from "zod";
13
+ import { assertPlaceholderCredentials } from "./credentials.js";
11
14
  import { guard, jsonResult } from "./result.js";
12
- /** A value is a safe placeholder if it's empty or a `{{ … }}` template. */
13
- function isPlaceholder(value) {
14
- if (value === "" || value === null || value === undefined)
15
- return true;
16
- return typeof value === "string" && /^\s*\{\{.*\}\}\s*$/.test(value);
17
- }
18
15
  export function registerPersonaTools(server, client) {
19
16
  server.tool("read_agent_persona", "Read an agent's persona (voice/character). A persona is 1:1 with an agent — " +
20
17
  "there is no standalone persona list.", { agentId: z.string().describe("The agent's id.") }, async ({ agentId }) => guard(async () => jsonResult(await client.get(`/api/v1/agents/${agentId}/persona`))));
@@ -24,34 +21,20 @@ export function registerPersonaTools(server, client) {
24
21
  .record(z.unknown())
25
22
  .describe('Persona fields, e.g. { "name": "…", "characterText": "…" }.'),
26
23
  }, async ({ agentId, fields }) => guard(async () => jsonResult(await client.post(`/api/v1/agents/${agentId}/persona`, fields))));
27
- server.tool("update_persona", "Update a persona by its id (read the agent's persona first for its version).", {
28
- personaId: z.string().describe("The persona's id."),
29
- expectedVersion: z
30
- .number()
31
- .int()
32
- .describe("The version you last read — 409 if stale."),
33
- fields: z.record(z.unknown()).describe("The fields to change (camelCase)."),
34
- }, async ({ personaId, expectedVersion, fields }) => guard(async () => jsonResult(await client.put(`/api/v1/personas/${personaId}`, {
35
- expectedVersion,
36
- ...fields,
37
- }))));
24
+ // Reading/updating a persona by its OWN id (list_personas, read_persona,
25
+ // update_persona, delete_persona, restore_persona, …) is generated generically
26
+ // from the "persona" EntityDef in index.ts — identical PUT semantics to what
27
+ // used to be hand-written here. Only the agent-scoped create/read above are
28
+ // bespoke, because personas have no standalone create route.
38
29
  }
39
30
  export function registerConnectorTools(server, client) {
40
- const authGuard = (fields) => {
41
- const authConfig = fields.authConfig;
42
- if (authConfig && !Object.values(authConfig).every(isPlaceholder)) {
43
- throw new Error("authConfig must contain only placeholders (empty or {{ … }}). Never put " +
44
- "real credentials in a connector — a human fills secrets in the Axonity " +
45
- "tool editor.");
46
- }
47
- };
48
31
  server.tool("create_connector", "Create a connector draft (a tool of type 'connector'). Do NOT put real " +
49
32
  "credentials in authConfig — use placeholders; a human fills secrets in Axonity.", {
50
33
  fields: z
51
34
  .record(z.unknown())
52
35
  .describe("Connector fields (name, description, implementation, authConfig)."),
53
36
  }, async ({ fields }) => guard(async () => {
54
- authGuard(fields);
37
+ assertPlaceholderCredentials(fields);
55
38
  return jsonResult(await client.post("/api/v1/tools", { type: "connector", ...fields }));
56
39
  }));
57
40
  server.tool("update_connector", "Update a connector draft (a tool of type 'connector'). Read it first for its " +
@@ -60,7 +43,7 @@ export function registerConnectorTools(server, client) {
60
43
  expectedVersion: z.number().int().describe("Version last read — 409 if stale."),
61
44
  fields: z.record(z.unknown()).describe("Fields to change (camelCase)."),
62
45
  }, async ({ id, expectedVersion, fields }) => guard(async () => {
63
- authGuard(fields);
46
+ assertPlaceholderCredentials(fields);
64
47
  return jsonResult(await client.put(`/api/v1/tools/${id}`, {
65
48
  expectedVersion,
66
49
  type: "connector",
@@ -69,13 +52,75 @@ export function registerConnectorTools(server, client) {
69
52
  }));
70
53
  }
71
54
  export function registerAttachTools(server, client) {
72
- const attach = (name, description, path, firstArg, secondArg) => server.tool(name, description, {
73
- [firstArg]: z.string(),
74
- [secondArg]: z.string(),
75
- }, async (args) => guard(async () => jsonResult(await client.post(path(args[firstArg], args[secondArg])))));
76
- attach("attach_skill_to_agent", "Scope a skill to an agent so the agent uses it.", (agentId, skillId) => `/api/v1/agents/${agentId}/skills-v2/${skillId}`, "agentId", "skillId");
77
- attach("attach_skill_to_workflow", "Scope a skill to a workflow.", (workflowId, skillId) => `/api/v1/workflows/${workflowId}/skills-v2/${skillId}`, "workflowId", "skillId");
78
- attach("attach_policy_to_agent", "Scope a policy to an agent.", (agentId, policyId) => `/api/v1/agents/${agentId}/policies/${policyId}`, "agentId", "policyId");
79
- attach("attach_reference_to_agent", "Scope a reference doc to an agent.", (agentId, refId) => `/api/v1/agents/${agentId}/reference-docs/${refId}`, "agentId", "refId");
55
+ /**
56
+ * Attach and detach are the same path with POST vs DELETE, so both verbs are
57
+ * generated from one definition — that is what keeps them from drifting apart
58
+ * again (only attach existed before, so nothing could be unwired).
59
+ */
60
+ const link = (subject, target, path, firstArg, secondArg,
61
+ /**
62
+ * The read-back tool for this link, when one exists. A 200 here does not
63
+ * prove the link resolved, so the description points at the tool that does —
64
+ * agent-scoped links have one, `skill → workflow` has no list route.
65
+ */
66
+ readBack) => {
67
+ const shape = { [firstArg]: z.string(), [secondArg]: z.string() };
68
+ server.tool(`attach_${subject}_to_${target}`, `Scope a ${subject.replace("_", " ")} to a ${target} so the ${target} uses it.` +
69
+ (readBack
70
+ ? ` Verify it landed with \`${readBack}\` before request_publish_${target} — ` +
71
+ `the link lives outside the entity body, so re-reading the ${target} will ` +
72
+ `not show it.`
73
+ : ""), shape, async (args) => guard(async () => jsonResult(await client.post(path(args[firstArg], args[secondArg])))));
74
+ server.tool(`detach_${subject}_from_${target}`, `Unscope a ${subject.replace("_", " ")} from a ${target}. This only ` +
75
+ `removes the link — the ${subject.replace("_", " ")} itself is not deleted ` +
76
+ `and stays available to attach elsewhere.` +
77
+ (readBack ? ` Confirm what is left with \`${readBack}\`.` : ""), shape, async (args) => guard(async () => {
78
+ await client.del(path(args[firstArg], args[secondArg]));
79
+ return jsonResult({
80
+ detached: true,
81
+ [firstArg]: args[firstArg],
82
+ [secondArg]: args[secondArg],
83
+ });
84
+ }));
85
+ };
86
+ link("skill", "agent", (agentId, skillId) => `/api/v1/agents/${agentId}/skills-v2/${skillId}`, "agentId", "skillId", "list_agent_skills");
87
+ // No read-back for the workflow-scoped variant: the backend has no
88
+ // GET /workflows/{id}/skills-v2, so there is nothing to point at.
89
+ link("skill", "workflow", (workflowId, skillId) => `/api/v1/workflows/${workflowId}/skills-v2/${skillId}`, "workflowId", "skillId");
90
+ link("policy", "agent", (agentId, policyId) => `/api/v1/agents/${agentId}/policies/${policyId}`, "agentId", "policyId", "list_agent_policies");
91
+ // Reference docs attach to agents only — there is no workflow-scoped
92
+ // reference-doc route on the backend, so no `*_to_workflow` pair here.
93
+ link("reference", "agent", (agentId, refId) => `/api/v1/agents/${agentId}/reference-docs/${refId}`, "agentId", "refId", "list_agent_reference_docs");
94
+ /**
95
+ * The read side of the links above. `attach_*`/`detach_*` write a link but
96
+ * return nothing you can list later, so these are how an agent verifies a
97
+ * link landed — and how it reads a source agent's wiring to reproduce it as
98
+ * new. All three are plain GETs, safe for read-only tokens.
99
+ */
100
+ const listLinks = (subject, plural, path) => {
101
+ server.tool(`list_agent_${plural}`, `List the ${subject} currently scoped to an agent — the read-back for ` +
102
+ `attach_${subject}_to_agent. Use it to confirm a link took, or to read a ` +
103
+ `source agent's wiring before recreating it. Read-only.`, { agentId: z.string().describe("The agent's id.") }, async ({ agentId }) => guard(async () => jsonResult(await client.get(path(agentId)))));
104
+ };
105
+ listLinks("skill", "skills", (id) => `/api/v1/agents/${id}/skills-v2`);
106
+ listLinks("policy", "policies", (id) => `/api/v1/agents/${id}/policies`);
107
+ listLinks("reference_doc", "reference_docs", (id) => `/api/v1/agents/${id}/reference-docs`);
108
+ }
109
+ /**
110
+ * Small standalone tools that don't fit any of the other groupings: the
111
+ * system-tools catalog (read-only — there is no grant/revoke route; enabling
112
+ * one for an agent means writing `systemToolIds` via `update_agent`), and
113
+ * cloning a flow/prompt-snippet into a tenant-owned copy.
114
+ */
115
+ export function registerCatalogTools(server, client) {
116
+ server.tool("list_system_tools", "List the tenant's system-tool catalog (id, label, description, category). " +
117
+ "There is no grant/revoke tool — enable one for an agent by adding its id " +
118
+ "to `systemToolIds` via update_agent.", {}, async () => guard(async () => jsonResult(await client.get("/api/v1/system-tools"))));
119
+ server.tool("clone_flow", "Fork a flow into a new, independent, tenant-owned copy — including a " +
120
+ "framework-provided one. Prefer this over editing a framework flow " +
121
+ "directly: it is visible and NOT actually protected from update_flow/ " +
122
+ "delete_flow (a backend gap, despite what its docstrings claim), so " +
123
+ "editing one in place risks changing something other tenants share.", { flowId: z.string().describe("The flow's id.") }, async ({ flowId }) => guard(async () => jsonResult(await client.post(`/api/v1/flows/${flowId}/clone`))));
124
+ server.tool("clone_prompt_snippet", "Duplicate a prompt snippet into a new, independent copy.", { snippetId: z.string().describe("The prompt snippet's id.") }, async ({ snippetId }) => guard(async () => jsonResult(await client.post(`/api/v1/prompt-snippets/${snippetId}/clone`))));
80
125
  }
81
126
  //# sourceMappingURL=extras.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extras.js","sourceRoot":"","sources":["../../src/tools/extras.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhD,2EAA2E;AAC3E,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvE,OAAO,OAAO,KAAK,KAAK,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;QAC1E,2EAA2E;QAC3E,sCAAsC,EACxC,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,CACpF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,YAAY,EACZ,uEAAuE;QACrE,oEAAoE;QACpE,uEAAuE;QACvE,qEAAqE;QACrE,oEAAoE,EACtE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EACjD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CACnB,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,iBAAiB,MAAM,QAAQ,CAAC,CAAC,CAAC,CACpF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,sBAAsB,EACtB,0DAA0D,EAC1D,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC,EAAE,EAC9D,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CACtB,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,2BAA2B,SAAS,QAAQ,CAAC,CAAC,CAC5E,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Prompt-element placement — where a prompt snippet actually takes effect.
3
+ *
4
+ * A snippet (the `prompt_snippet` entity) is a LIBRARY item: creating it does
5
+ * nothing on its own. It only shapes a run once it is PLACED into a flow step's
6
+ * prompt stack — in the `system` or `user` channel, at a chosen order — or made
7
+ * a tenant-wide "wildcard" that sits at the top of every step's stack.
8
+ *
9
+ * These tools wrap the placement routes in the backend's `prompt_snippets.py`.
10
+ * The snippet CRUD itself is the generic `*_prompt_snippet` entity family; this
11
+ * module is only the linking layer that the generic registrar can't express.
12
+ */
13
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
+ import type { AxonityClient } from "../client.js";
15
+ export declare function registerPromptPlacementTools(server: McpServer, client: AxonityClient): void;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Prompt-element placement — where a prompt snippet actually takes effect.
3
+ *
4
+ * A snippet (the `prompt_snippet` entity) is a LIBRARY item: creating it does
5
+ * nothing on its own. It only shapes a run once it is PLACED into a flow step's
6
+ * prompt stack — in the `system` or `user` channel, at a chosen order — or made
7
+ * a tenant-wide "wildcard" that sits at the top of every step's stack.
8
+ *
9
+ * These tools wrap the placement routes in the backend's `prompt_snippets.py`.
10
+ * The snippet CRUD itself is the generic `*_prompt_snippet` entity family; this
11
+ * module is only the linking layer that the generic registrar can't express.
12
+ */
13
+ import { z } from "zod";
14
+ import { guard, jsonResult } from "./result.js";
15
+ /** The two prompt channels a snippet can be placed in. */
16
+ const TARGET = z
17
+ .enum(["system", "user"])
18
+ .describe("Which prompt channel to place the snippet in: 'system' (instructions the " +
19
+ "model is steered by) or 'user' (content presented as the user turn).");
20
+ export function registerPromptPlacementTools(server, client) {
21
+ server.tool("list_flow_step_prompts", "List the prompt snippets attached to a flow step — its `system` and `user` " +
22
+ "prompt stacks, each entry with its link id and display order. This is how " +
23
+ "you see a step's current prompt composition before changing it. Excludes " +
24
+ "wildcard snippets (see list_wildcard_prompts). Read-only.", { flowStepId: z.string().describe("The flow step's id.") }, async ({ flowStepId }) => guard(async () => jsonResult(await client.get(`/api/v1/flow-steps/${flowStepId}/prompts`))));
25
+ server.tool("attach_prompt_snippet_to_flow_step", "Place a library prompt snippet into a flow step's prompt stack. Choose the " +
26
+ "channel (`target`: system/user) and its order in that channel. This is " +
27
+ "what makes a snippet actually shape the step's prompt — creating the " +
28
+ "snippet alone does nothing. Returns the created link (with its linkId) so " +
29
+ "you can reorder or detach it later.", {
30
+ flowStepId: z.string().describe("The flow step's id."),
31
+ snippetId: z.string().describe("The prompt snippet's id (a UUID)."),
32
+ target: TARGET,
33
+ displayOrder: z
34
+ .number()
35
+ .int()
36
+ .min(0)
37
+ .optional()
38
+ .describe("Position within the chosen channel (0 = first). Defaults to 0."),
39
+ }, async ({ flowStepId, snippetId, target, displayOrder }) => guard(async () => jsonResult(await client.post(`/api/v1/flow-steps/${flowStepId}/prompts`, {
40
+ snippetId,
41
+ target,
42
+ ...(displayOrder === undefined ? {} : { displayOrder }),
43
+ }))));
44
+ server.tool("update_flow_step_prompt", "Change an existing flow-step prompt attachment: move it between the system " +
45
+ "and user channel, and/or change its display order. Identify it by its " +
46
+ "linkId (from list_flow_step_prompts or the attach response), NOT the " +
47
+ "snippet id. Send only what you are changing.", {
48
+ linkId: z.string().describe("The attachment's link id (not the snippet id)."),
49
+ target: z
50
+ .enum(["system", "user"])
51
+ .optional()
52
+ .describe("New channel. Omit to leave it unchanged."),
53
+ displayOrder: z
54
+ .number()
55
+ .int()
56
+ .min(0)
57
+ .optional()
58
+ .describe("New position in its channel. Omit to leave it unchanged."),
59
+ }, async ({ linkId, target, displayOrder }) => guard(async () => {
60
+ const body = {};
61
+ if (target !== undefined)
62
+ body.target = target;
63
+ if (displayOrder !== undefined)
64
+ body.displayOrder = displayOrder;
65
+ return jsonResult(await client.patch(`/api/v1/flow-step-prompts/${linkId}`, body));
66
+ }));
67
+ server.tool("reorder_flow_step_prompts", "Set the full ordering of a flow step's prompt snippets in one call. Pass the " +
68
+ "snippet ids in the order you want them; the backend replaces the step's " +
69
+ "ordering with this list. Read the step first (list_flow_step_prompts) so " +
70
+ "you include every snippet — omitting one is a reorder, not a safe no-op.", {
71
+ flowStepId: z.string().describe("The flow step's id."),
72
+ snippetIds: z
73
+ .array(z.string())
74
+ .min(1)
75
+ .max(512)
76
+ .describe("Snippet ids (UUIDs) in the desired order."),
77
+ }, async ({ flowStepId, snippetIds }) => guard(async () => jsonResult(await client.put(`/api/v1/flow-steps/${flowStepId}/prompts/order`, {
78
+ snippetIds,
79
+ }))));
80
+ server.tool("detach_prompt_snippet_from_flow_step", "Remove a prompt snippet from a flow step's stack. This only unlinks it — the " +
81
+ "snippet itself is not deleted and stays available to place elsewhere. " +
82
+ "Identify the link by its linkId (from list_flow_step_prompts).", { linkId: z.string().describe("The attachment's link id (not the snippet id).") }, async ({ linkId }) => guard(async () => {
83
+ await client.del(`/api/v1/flow-step-prompts/${linkId}`);
84
+ return jsonResult({ detached: true, linkId });
85
+ }));
86
+ server.tool("read_workflow_prompt_stacks", "Resolve a workflow to its flow steps and each step's prompt stack in one " +
87
+ "read: per step you get its flowStepId, name, and its system/user prompt " +
88
+ "snippets (with link ids and order). This is how you discover the " +
89
+ "flowStepIds you need before placing prompts, and how you see a workflow's " +
90
+ "whole prompt composition. Read-only.", { workflowId: z.string().describe("The workflow's id.") }, async ({ workflowId }) => guard(async () => jsonResult(await client.get(`/api/v1/workflows/${workflowId}/prompt-stacks`))));
91
+ server.tool("read_flow_prompt_stacks", "The flow-scoped counterpart of read_workflow_prompt_stacks: resolve a flow " +
92
+ "to its steps and their system/user prompt stacks (flowStepId, link ids, " +
93
+ "order). Read-only.", { flowId: z.string().describe("The flow's id.") }, async ({ flowId }) => guard(async () => jsonResult(await client.get(`/api/v1/flows/${flowId}/prompt-stacks`))));
94
+ server.tool("list_wildcard_prompts", "List the tenant's wildcard prompt snippets — those that apply to EVERY flow " +
95
+ "step (they sit at the top of each step's prompt stack). Use this for " +
96
+ "cross-cutting instructions that should hold everywhere, rather than " +
97
+ "attaching the same snippet to every step by hand. Read-only.", {}, async () => guard(async () => jsonResult(await client.get("/api/v1/wildcard-prompts"))));
98
+ }
99
+ //# sourceMappingURL=promptPlacement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptPlacement.js","sourceRoot":"","sources":["../../src/tools/promptPlacement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,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AAyB,EACzB,6EAA6E;QAC3E,0EAA0E;QAC1E,oBAAoB,EACtB,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EACjD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CACnB,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,MAAM,gBAAgB,CAAC,CAAC,CACtE,CACJ,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,8EAA8E;QAC5E,uEAAuE;QACvE,sEAAsE;QACtE,8DAA8D,EAChE,EAAE,EACF,KAAK,IAAI,EAAE,CACT,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAC9E,CAAC;AACJ,CAAC"}
@@ -1,19 +1,25 @@
1
1
  /**
2
- * Registers the read/draft/update MCP tools for one Axonity entity type.
2
+ * Registers the read/draft/update/lifecycle MCP tools for one Axonity entity type.
3
3
  *
4
- * Every entity (workflow, agent, tool) gets the same verbs the internal
5
- * Builder team has, minus direct publish:
6
- * list_<entity> — GET /api/v1/<entity>s
7
- * read_<entity> — GET /api/v1/<entity>s/{id}
8
- * create_<entity> — POST /api/v1/<entity>s (a new draft)
9
- * update_<entity> — PUT|PATCH /api/v1/<entity>s/{id} (read-then-write)
4
+ * Every entity gets the same verbs the internal Builder team has, minus direct
5
+ * publish:
6
+ * list_<plural> — GET <basePath>
7
+ * read_<entity> — GET <basePath>/{id}
8
+ * create_<entity> — POST <basePath> (a new draft)
9
+ * update_<entity> — PUT|PATCH <basePath>/{id} (read-then-write)
10
+ * delete_<entity> — DELETE <basePath>/{id} (soft-delete, recoverable)
11
+ * restore_<entity> — POST <basePath>/{id}/restore (undo a delete)
12
+ * list_deleted_<plural> — restore candidates
13
+ * discard_<entity>_draft — reset the draft to the last published state
10
14
  *
11
15
  * The connector stays thin: entity fields pass through as JSON and the backend
12
- * validates them (422 surfaces the field detail). Updates carry `expectedVersion`
13
- * so a stale write 409s rather than clobbering — the agent re-reads and retries.
16
+ * validates them (a structured error names the offending field — see errors.ts).
17
+ * Updates carry `expectedVersion` in the body so a stale write 409s rather than
18
+ * clobbering. Deletes carry it as a QUERY param instead, and the key's spelling
19
+ * is not uniform across entities (`deleteVersionParam` on `EntityDef` says which).
14
20
  *
15
21
  * `request_publish_*` never publishes — it creates a pending approval a human
16
- * decides in Axonity (epic #652 C3).
22
+ * decides in Axonity.
17
23
  */
18
24
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
19
25
  import type { AxonityClient } from "../client.js";
@@ -26,5 +32,56 @@ export interface EntityDef {
26
32
  updateMethod: "PUT" | "PATCH";
27
33
  /** One-line human description of the entity, for the tool docs. */
28
34
  label: string;
35
+ /**
36
+ * Optional pre-write check on the caller's fields, applied to `create_*` and
37
+ * `update_*`. Throws to reject. Used to run the connector credential guard on
38
+ * plain tool writes, which would otherwise bypass it.
39
+ */
40
+ guardFields?: (fields: Record<string, unknown>) => void;
41
+ /**
42
+ * Whether `request_publish_<entity>` is generated. Default true, and true for
43
+ * every current entity: all ten (flow included) are valid `entityType`s for a
44
+ * publish approval on the backend (`ApprovalEntityType`). Set false only for a
45
+ * future entity that genuinely cannot be publish-approved.
46
+ */
47
+ publishable?: boolean;
48
+ /**
49
+ * The plural noun for `list_<plural>` / `list_deleted_<plural>`. Defaults to
50
+ * `${singular}s`, which is wrong for at least "policy" — set it explicitly
51
+ * rather than shipping `list_policys`.
52
+ */
53
+ plural?: string;
54
+ /** Whether `create_<entity>` is generated. Default true. False for `persona`, whose create is agent-scoped (`create_agent_persona`). */
55
+ creatable?: boolean;
56
+ /**
57
+ * Whether `read_<entity>` is generated. Default true, and true for every
58
+ * current entity — `prompt_snippet` does have a single-read route
59
+ * (`GET /api/v1/prompt-snippets/{id}`). Kept as an escape hatch for a future
60
+ * entity with no single-read route.
61
+ */
62
+ readable?: boolean;
63
+ /**
64
+ * The query-string key DELETE expects for the optimistic lock. Its presence
65
+ * is what turns on `delete_/restore_/list_deleted_/discard_*` — omit it for
66
+ * an entity with no lifecycle routes. The two spellings are a real backend
67
+ * inconsistency, not a typo: `expectedVersion` (workflow, agent, tool,
68
+ * prompt_snippet, flow) vs `expected_version` (skill, policy, reference_doc,
69
+ * output_schema, persona).
70
+ */
71
+ deleteVersionParam?: "expectedVersion" | "expected_version";
72
+ /**
73
+ * Whether `discard_<entity>_draft` is generated. Default true when the entity
74
+ * is deletable, and true for every current entity — both `flow` and
75
+ * `prompt_snippet` have a discard-draft route
76
+ * (`POST .../{id}/discard-draft`). Escape hatch for a future entity lacking one.
77
+ */
78
+ hasDiscardDraft?: boolean;
79
+ /**
80
+ * How to list soft-deleted rows. `"collection"` (default) is `GET
81
+ * <basePath>/deleted` and is what every current entity uses, `prompt_snippet`
82
+ * included (`GET /api/v1/prompt-snippets/deleted`). `"query"` (`?deleted=true`
83
+ * on the main list) is retained for a future entity that needs it.
84
+ */
85
+ deletedListPath?: "collection" | "query";
29
86
  }
30
87
  export declare function registerEntityTools(server: McpServer, client: AxonityClient, def: EntityDef): void;
@@ -1,35 +1,56 @@
1
1
  /**
2
- * Registers the read/draft/update MCP tools for one Axonity entity type.
2
+ * Registers the read/draft/update/lifecycle MCP tools for one Axonity entity type.
3
3
  *
4
- * Every entity (workflow, agent, tool) gets the same verbs the internal
5
- * Builder team has, minus direct publish:
6
- * list_<entity> — GET /api/v1/<entity>s
7
- * read_<entity> — GET /api/v1/<entity>s/{id}
8
- * create_<entity> — POST /api/v1/<entity>s (a new draft)
9
- * update_<entity> — PUT|PATCH /api/v1/<entity>s/{id} (read-then-write)
4
+ * Every entity gets the same verbs the internal Builder team has, minus direct
5
+ * publish:
6
+ * list_<plural> — GET <basePath>
7
+ * read_<entity> — GET <basePath>/{id}
8
+ * create_<entity> — POST <basePath> (a new draft)
9
+ * update_<entity> — PUT|PATCH <basePath>/{id} (read-then-write)
10
+ * delete_<entity> — DELETE <basePath>/{id} (soft-delete, recoverable)
11
+ * restore_<entity> — POST <basePath>/{id}/restore (undo a delete)
12
+ * list_deleted_<plural> — restore candidates
13
+ * discard_<entity>_draft — reset the draft to the last published state
10
14
  *
11
15
  * The connector stays thin: entity fields pass through as JSON and the backend
12
- * validates them (422 surfaces the field detail). Updates carry `expectedVersion`
13
- * so a stale write 409s rather than clobbering — the agent re-reads and retries.
16
+ * validates them (a structured error names the offending field — see errors.ts).
17
+ * Updates carry `expectedVersion` in the body so a stale write 409s rather than
18
+ * clobbering. Deletes carry it as a QUERY param instead, and the key's spelling
19
+ * is not uniform across entities (`deleteVersionParam` on `EntityDef` says which).
14
20
  *
15
21
  * `request_publish_*` never publishes — it creates a pending approval a human
16
- * decides in Axonity (epic #652 C3).
22
+ * decides in Axonity.
17
23
  */
18
24
  import { z } from "zod";
19
25
  import { guard, jsonResult } from "./result.js";
26
+ /** A required literal — an agent cannot satisfy it by filling in a default. */
27
+ const CONFIRM = z
28
+ .literal(true)
29
+ .describe("Must be true. Acknowledges you understand this is destructive.");
20
30
  export function registerEntityTools(server, client, def) {
21
- const { singular, basePath, updateMethod, label } = def;
22
- server.tool(`list_${singular}s`, `List all ${label} in your Axonity tenant (id, name, status, version).`, {}, async () => guard(async () => jsonResult(await client.get(basePath))));
23
- server.tool(`read_${singular}`, `Read one ${singular} by id, including its current draft and version. ` +
24
- `Read before you update — you need the current version.`, { id: z.string().describe(`The ${singular}'s id.`) }, async ({ id }) => guard(async () => jsonResult(await client.get(`${basePath}/${id}`))));
25
- server.tool(`create_${singular}`, `Create a new ${singular} draft. Pass the entity's fields (camelCase) in ` +
26
- `\`fields\`; the backend validates them. Returns the created ${singular} ` +
27
- `with its id and version.`, {
28
- fields: z
29
- .record(z.unknown())
30
- .describe(`The ${singular}'s fields as a JSON object (camelCase keys), e.g. ` +
31
- `{ "name": "…", "description": "…" }.`),
32
- }, async ({ fields }) => guard(async () => jsonResult(await client.post(basePath, fields))));
31
+ const { singular, basePath, updateMethod, label, guardFields } = def;
32
+ const plural = def.plural ?? `${singular}s`;
33
+ const publishable = def.publishable !== false;
34
+ const creatable = def.creatable !== false;
35
+ const readable = def.readable !== false;
36
+ server.tool(`list_${plural}`, `List all ${label} in your Axonity tenant (id, name, status, version).`, {}, async () => guard(async () => jsonResult(await client.get(basePath))));
37
+ if (readable) {
38
+ server.tool(`read_${singular}`, `Read one ${singular} by id, including its current draft and version. ` +
39
+ `Read before you update — you need the current version.`, { id: z.string().describe(`The ${singular}'s id.`) }, async ({ id }) => guard(async () => jsonResult(await client.get(`${basePath}/${id}`))));
40
+ }
41
+ if (creatable) {
42
+ server.tool(`create_${singular}`, `Create a new ${singular} draft. Pass the entity's fields (camelCase) in ` +
43
+ `\`fields\`; the backend validates them. Returns the created ${singular} ` +
44
+ `with its id and version.`, {
45
+ fields: z
46
+ .record(z.unknown())
47
+ .describe(`The ${singular}'s fields as a JSON object (camelCase keys), e.g. ` +
48
+ `{ "name": "…", "description": "…" }.`),
49
+ }, async ({ fields }) => guard(async () => {
50
+ guardFields?.(fields);
51
+ return jsonResult(await client.post(basePath, fields));
52
+ }));
53
+ }
33
54
  server.tool(`update_${singular}`, `Update a ${singular} draft. Read it first to get \`expectedVersion\`; on a ` +
34
55
  `409 conflict, read again and retry. Pass only the fields you are ` +
35
56
  `changing (camelCase) in \`fields\`.`, {
@@ -42,6 +63,7 @@ export function registerEntityTools(server, client, def) {
42
63
  .record(z.unknown())
43
64
  .describe(`The fields to change, as a JSON object (camelCase keys).`),
44
65
  }, async ({ id, expectedVersion, fields }) => guard(async () => {
66
+ guardFields?.(fields);
45
67
  const body = { expectedVersion, ...fields };
46
68
  const path = `${basePath}/${id}`;
47
69
  const data = updateMethod === "PUT"
@@ -49,6 +71,39 @@ export function registerEntityTools(server, client, def) {
49
71
  : await client.patch(path, body);
50
72
  return jsonResult(data);
51
73
  }));
74
+ if (def.deleteVersionParam) {
75
+ const deleteVersionParam = def.deleteVersionParam;
76
+ const hasDiscardDraft = def.hasDiscardDraft !== false;
77
+ server.tool(`delete_${singular}`, `Delete a ${singular}. Destructive, but RECOVERABLE — it is soft-deleted ` +
78
+ `and can be brought back with restore_${singular} (it will not appear in ` +
79
+ `list_${plural} until then). Read it first for its version. A 409 here ` +
80
+ `may be a stale version (re-read and retry) or a reference conflict ` +
81
+ `(something published still uses it — re-reading will not help; the ` +
82
+ `error tells you which).`, {
83
+ id: z.string().describe(`The ${singular}'s id.`),
84
+ expectedVersion: z
85
+ .number()
86
+ .int()
87
+ .describe("The version you last read — rejected with 409 if stale."),
88
+ confirm: CONFIRM,
89
+ }, async ({ id, expectedVersion }) => guard(async () => {
90
+ await client.del(`${basePath}/${id}`, { [deleteVersionParam]: expectedVersion });
91
+ return jsonResult({ deleted: true, id });
92
+ }));
93
+ server.tool(`restore_${singular}`, `Undo delete_${singular} — bring a soft-deleted ${singular} back. Takes no ` +
94
+ `version check (a restore must never lose to a stale-version guard). Can ` +
95
+ `409 if a live ${singular} now holds a name/slot this one also claims.`, { id: z.string().describe(`The ${singular}'s id.`) }, async ({ id }) => guard(async () => jsonResult(await client.post(`${basePath}/${id}/restore`))));
96
+ server.tool(`list_deleted_${plural}`, `List soft-deleted ${label} — the restore candidates for restore_${singular}.`, {}, async () => guard(async () => jsonResult(def.deletedListPath === "query"
97
+ ? await client.get(basePath, { deleted: true })
98
+ : await client.get(`${basePath}/deleted`))));
99
+ if (hasDiscardDraft) {
100
+ server.tool(`discard_${singular}_draft`, `Discard uncommitted draft edits on a ${singular}, resetting it to its ` +
101
+ `last published state. Fails if it has never been published — there is ` +
102
+ `no published state to fall back to.`, { id: z.string().describe(`The ${singular}'s id.`) }, async ({ id }) => guard(async () => jsonResult(await client.post(`${basePath}/${id}/discard-draft`))));
103
+ }
104
+ }
105
+ if (!publishable)
106
+ return;
52
107
  server.tool(`request_publish_${singular}`, `Request that a ${singular} be published. This does NOT publish it — it ` +
53
108
  `creates a pending approval a human approves in Axonity. Returns the ` +
54
109
  `pending approval (with its readiness).`, {
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/tools/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAahD,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,MAAqB,EACrB,GAAc;IAEd,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;IAExD,MAAM,CAAC,IAAI,CACT,QAAQ,QAAQ,GAAG,EACnB,YAAY,KAAK,sDAAsD,EACvE,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CACtE,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,QAAQ,QAAQ,EAAE,EAClB,YAAY,QAAQ,mDAAmD;QACrE,wDAAwD,EAC1D,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,QAAQ,QAAQ,CAAC,EAAE,EACpD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CACf,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CACvE,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,UAAU,QAAQ,EAAE,EACpB,gBAAgB,QAAQ,kDAAkD;QACxE,+DAA+D,QAAQ,GAAG;QAC1E,0BAA0B,EAC5B;QACE,MAAM,EAAE,CAAC;aACN,MAAM,CAAC,CAAC,CAAC,O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;QAC7C,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,EAAE;QACZ,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC,CACH,CACF,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Run observability — how an agent evaluates what it built.
3
+ *
4
+ * There is no "findings" endpoint and no evaluator entity. Evaluation means
5
+ * reading runs: the run detail carries `validatorVerdicts` and
6
+ * `agentInvocations`, and the trace carries the step-by-step tool calls. Those
7
+ * are the evidence an agent reasons over.
8
+ *
9
+ * Runs are also the only thing in the product with a real archive state —
10
+ * entities have soft-delete, runs have archive/unarchive.
11
+ */
12
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
13
+ import type { AxonityClient } from "../client.js";
14
+ export declare function registerRunTools(server: McpServer, client: AxonityClient): void;