@datar-platform/cli 0.1.0-alpha.0

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 (42) hide show
  1. package/README.md +131 -0
  2. package/dist/config.d.ts +24 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +50 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/http.d.ts +9 -0
  7. package/dist/http.d.ts.map +1 -0
  8. package/dist/http.js +22 -0
  9. package/dist/http.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +166 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/mcp/registry.d.ts +26 -0
  15. package/dist/mcp/registry.d.ts.map +1 -0
  16. package/dist/mcp/registry.js +18 -0
  17. package/dist/mcp/registry.js.map +1 -0
  18. package/dist/mcp/server.d.ts +20 -0
  19. package/dist/mcp/server.d.ts.map +1 -0
  20. package/dist/mcp/server.js +75 -0
  21. package/dist/mcp/server.js.map +1 -0
  22. package/dist/mcp/tools/ask.d.ts +14 -0
  23. package/dist/mcp/tools/ask.d.ts.map +1 -0
  24. package/dist/mcp/tools/ask.js +66 -0
  25. package/dist/mcp/tools/ask.js.map +1 -0
  26. package/dist/mcp/tools/discovery.d.ts +10 -0
  27. package/dist/mcp/tools/discovery.d.ts.map +1 -0
  28. package/dist/mcp/tools/discovery.js +76 -0
  29. package/dist/mcp/tools/discovery.js.map +1 -0
  30. package/dist/mcp/tools/index.d.ts +23 -0
  31. package/dist/mcp/tools/index.d.ts.map +1 -0
  32. package/dist/mcp/tools/index.js +29 -0
  33. package/dist/mcp/tools/index.js.map +1 -0
  34. package/dist/mcp/tools/query.d.ts +16 -0
  35. package/dist/mcp/tools/query.d.ts.map +1 -0
  36. package/dist/mcp/tools/query.js +87 -0
  37. package/dist/mcp/tools/query.js.map +1 -0
  38. package/dist/mcp/tools/reads.d.ts +9 -0
  39. package/dist/mcp/tools/reads.d.ts.map +1 -0
  40. package/dist/mcp/tools/reads.js +177 -0
  41. package/dist/mcp/tools/reads.js.map +1 -0
  42. package/package.json +78 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Natural-language fallback — forward a free-form question to a Datar A2A agent
3
+ * (or the orchestrator, which routes for you). This reuses the whole agent
4
+ * stack (tool-calling, KB grounding, cross-service delegation) for anything the
5
+ * typed read tools don't cover.
6
+ *
7
+ * THIS TOOL CAN ACT. The agent may call mutating endpoints, and token scopes do
8
+ * NOT reliably stop it (serviceProcedure endpoints skip the scope middleware).
9
+ * So it is registered only when DATAR_MCP_ALLOW_AGENT=1 — the default read-only
10
+ * surface omits it entirely. See ./index.ts and the CLI README.
11
+ */
12
+ import { z } from "zod";
13
+ import { tool } from "../registry.js";
14
+ const SERVICES = [
15
+ "orchestrator",
16
+ "drive",
17
+ "projects",
18
+ "people",
19
+ "requests",
20
+ "inventory",
21
+ "messages",
22
+ "social",
23
+ "procurement",
24
+ "transact",
25
+ "isms",
26
+ "advice",
27
+ ];
28
+ export const askTool = tool({
29
+ name: "datar_ask",
30
+ description: "Ask a Datar service agent a natural-language question. Defaults to the " +
31
+ "orchestrator, which routes to the right service(s). Use this for anything " +
32
+ "not covered by the typed read tools. Returns the agent's reply plus any " +
33
+ "structured data it produced. CAN ACT — the agent may perform writes.",
34
+ inputSchema: {
35
+ message: z
36
+ .string()
37
+ .min(1)
38
+ .max(4000)
39
+ .describe("The question or instruction."),
40
+ service: z
41
+ .enum(SERVICES)
42
+ .optional()
43
+ .describe("Target service; omit to use the orchestrator."),
44
+ contextId: z
45
+ .string()
46
+ .optional()
47
+ .describe("Pass a prior reply's contextId to continue the conversation."),
48
+ },
49
+ handler: async (client, args) => {
50
+ const service = SERVICES.includes(String(args.service))
51
+ ? args.service
52
+ : "orchestrator";
53
+ const res = await client.ai.ask({
54
+ service,
55
+ message: String(args.message),
56
+ contextId: typeof args.contextId === "string" ? args.contextId : undefined,
57
+ });
58
+ return {
59
+ text: res.text,
60
+ data: res.data,
61
+ routedTo: res.routedTo,
62
+ contextId: res.contextId,
63
+ };
64
+ },
65
+ });
66
+ //# sourceMappingURL=ask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask.js","sourceRoot":"","sources":["../../../src/mcp/tools/ask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,QAAQ,GAAG;IACf,cAAc;IACd,OAAO;IACP,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,UAAU;IACV,QAAQ;IACR,aAAa;IACb,UAAU;IACV,MAAM;IACN,QAAQ;CACA,CAAC;AAIX,MAAM,CAAC,MAAM,OAAO,GAAY,IAAI,CAAC;IACnC,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,yEAAyE;QACzE,4EAA4E;QAC5E,0EAA0E;QAC1E,sEAAsE;IACxE,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,IAAI,CAAC;aACT,QAAQ,CAAC,8BAA8B,CAAC;QAC3C,OAAO,EAAE,CAAC;aACP,IAAI,CAAC,QAAQ,CAAC;aACd,QAAQ,EAAE;aACV,QAAQ,CAAC,+CAA+C,CAAC;QAC5D,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8DAA8D,CAAC;KAC5E;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAI,QAA8B,CAAC,QAAQ,CACtD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CACrB;YACC,CAAC,CAAE,IAAI,CAAC,OAAmB;YAC3B,CAAC,CAAC,cAAc,CAAC;QACnB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC;YAC9B,OAAO;YACP,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YAC7B,SAAS,EACP,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;SAClE,CAAC,CAAC;QACH,OAAO;YACL,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Discovery tools — the "what can I do / who am I" surface. These are what make
3
+ * the harness feel like it's connected to a live org (à la `aws sts get-caller-
4
+ * identity` + a service catalog): the token resolves the tenant, and the agent
5
+ * cards provide the endpoint/schema catalog that makes downstream work precise.
6
+ */
7
+ import type { ResolvedConfig } from "../../config.js";
8
+ import type { ToolDef } from "../registry.js";
9
+ export declare function buildDiscoveryTools(config: ResolvedConfig): ToolDef[];
10
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/discovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqB9C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,EAAE,CAwErE"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Discovery tools — the "what can I do / who am I" surface. These are what make
3
+ * the harness feel like it's connected to a live org (à la `aws sts get-caller-
4
+ * identity` + a service catalog): the token resolves the tenant, and the agent
5
+ * cards provide the endpoint/schema catalog that makes downstream work precise.
6
+ */
7
+ import { z } from "zod";
8
+ import { datarGet } from "../../http.js";
9
+ import { tool } from "../registry.js";
10
+ export function buildDiscoveryTools(config) {
11
+ return [
12
+ tool({
13
+ name: "datar_whoami",
14
+ description: "Resolve the identity this API token maps to: the current user, the " +
15
+ "organization(s)/tenant the token is bound to, and the base URL. Call " +
16
+ "this first to confirm you are pointed at the right Datar org.",
17
+ inputSchema: {},
18
+ handler: async (client) => {
19
+ const [profile, tenants] = await Promise.allSettled([
20
+ client.query("v2.auth.getProfile"),
21
+ client.query("v2.auth.resolveTenantsForSession"),
22
+ ]);
23
+ return {
24
+ baseUrl: config.baseUrl,
25
+ credentialSource: config.source,
26
+ user: profile.status === "fulfilled" ? profile.value : null,
27
+ tenants: tenants.status === "fulfilled" ? tenants.value : null,
28
+ note: "Access is limited to this token's scopes. A read-only token cannot mutate.",
29
+ };
30
+ },
31
+ }),
32
+ tool({
33
+ name: "datar_list_services",
34
+ description: "List all Datar A2A service agents available to this org (drive, " +
35
+ "people, projects, requests, isms, procurement, inventory, transact, " +
36
+ "messages, social, advice, orchestrator). The catalog to read first.",
37
+ inputSchema: {},
38
+ handler: async (client) => {
39
+ // tRPC catalog (ids + active provider) …
40
+ const services = await client.query("v2.ai.agents.listServices");
41
+ // … enriched with the discoverable agent cards (skills + schemas).
42
+ let cards = [];
43
+ try {
44
+ cards = await datarGet(config, "/api/a2a/agents");
45
+ }
46
+ catch {
47
+ // Agent-card route optional / auth-gated differently — ids still useful.
48
+ }
49
+ return {
50
+ services,
51
+ cards: cards.map((c) => ({
52
+ name: c.name,
53
+ skills: c.skills.map((s) => s.id),
54
+ })),
55
+ };
56
+ },
57
+ }),
58
+ tool({
59
+ name: "datar_describe_service",
60
+ description: "Describe one Datar service agent in full: its skills with input/output " +
61
+ "JSON schemas and examples, straight from the agent card. Use this to " +
62
+ "learn the exact shape of a service's capabilities before calling them.",
63
+ inputSchema: {
64
+ service: z
65
+ .string()
66
+ .describe("Service id, e.g. 'drive', 'procurement', 'transact'."),
67
+ },
68
+ handler: async (_client, args) => {
69
+ const service = String(args.service);
70
+ const card = await datarGet(config, `/api/a2a/${service}/.well-known/agent.json`);
71
+ return card;
72
+ },
73
+ }),
74
+ ];
75
+ }
76
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/mcp/tools/discovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAmBtC,MAAM,UAAU,mBAAmB,CAAC,MAAsB;IACxD,OAAO;QACL,IAAI,CAAC;YACH,IAAI,EAAE,cAAc;YACpB,WAAW,EACT,qEAAqE;gBACrE,uEAAuE;gBACvE,+DAA+D;YACjE,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBACxB,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;oBAClD,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC;oBAClC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC;iBACjD,CAAC,CAAC;gBACH,OAAO;oBACL,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,gBAAgB,EAAE,MAAM,CAAC,MAAM;oBAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;oBAC3D,OAAO,EAAE,OAAO,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;oBAC9D,IAAI,EAAE,4EAA4E;iBACnF,CAAC;YACJ,CAAC;SACF,CAAC;QAEF,IAAI,C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CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Assemble the v1 tool registry.
3
+ *
4
+ * READ-ONLY BY DEFAULT — and the guarantee is CLIENT-SIDE, not scope-based:
5
+ * every discovery/read tool and `datar_query` issue HTTP GETs only, and tRPC
6
+ * refuses mutations over GET, so they cannot write regardless of the token's
7
+ * scopes. (Token scopes are NOT a reliable guard here: `serviceProcedure`
8
+ * endpoints — most of the API — skip the scope-enforcement middleware, so a
9
+ * "read-scoped" token can still write through them. See the CLI README.)
10
+ *
11
+ * `datar_ask` is the ONE tool that can act: it drives an A2A agent, which may
12
+ * call mutating endpoints. It is therefore OPT-IN — registered only when
13
+ * `allowAgent` is true (env `DATAR_MCP_ALLOW_AGENT=1`). Default off keeps the
14
+ * whole surface provably read-only.
15
+ */
16
+ import type { ResolvedConfig } from "../../config.js";
17
+ import type { ToolDef } from "../registry.js";
18
+ export interface RegistryOptions {
19
+ /** Register the acting `datar_ask` tool. Default: env DATAR_MCP_ALLOW_AGENT === "1". */
20
+ allowAgent?: boolean;
21
+ }
22
+ export declare function buildRegistry(config: ResolvedConfig, opts?: RegistryOptions): ToolDef[];
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9C,MAAM,WAAW,eAAe;IAC9B,wFAAwF;IACxF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE,eAAoB,GACzB,OAAO,EAAE,CASX"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Assemble the v1 tool registry.
3
+ *
4
+ * READ-ONLY BY DEFAULT — and the guarantee is CLIENT-SIDE, not scope-based:
5
+ * every discovery/read tool and `datar_query` issue HTTP GETs only, and tRPC
6
+ * refuses mutations over GET, so they cannot write regardless of the token's
7
+ * scopes. (Token scopes are NOT a reliable guard here: `serviceProcedure`
8
+ * endpoints — most of the API — skip the scope-enforcement middleware, so a
9
+ * "read-scoped" token can still write through them. See the CLI README.)
10
+ *
11
+ * `datar_ask` is the ONE tool that can act: it drives an A2A agent, which may
12
+ * call mutating endpoints. It is therefore OPT-IN — registered only when
13
+ * `allowAgent` is true (env `DATAR_MCP_ALLOW_AGENT=1`). Default off keeps the
14
+ * whole surface provably read-only.
15
+ */
16
+ import { askTool } from "./ask.js";
17
+ import { buildDiscoveryTools } from "./discovery.js";
18
+ import { queryTool } from "./query.js";
19
+ import { readTools } from "./reads.js";
20
+ export function buildRegistry(config, opts = {}) {
21
+ const allowAgent = opts.allowAgent ?? process.env.DATAR_MCP_ALLOW_AGENT === "1";
22
+ return [
23
+ ...buildDiscoveryTools(config),
24
+ ...readTools,
25
+ queryTool,
26
+ ...(allowAgent ? [askTool] : []),
27
+ ];
28
+ }
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAOvC,MAAM,UAAU,aAAa,CAC3B,MAAsB,EACtB,OAAwB,EAAE;IAE1B,MAAM,UAAU,GACd,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG,CAAC;IAC/D,OAAO;QACL,GAAG,mBAAmB,CAAC,MAAM,CAAC;QAC9B,GAAG,SAAS;QACZ,SAAS;QACT,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Generic read escape hatch — call ANY Datar tRPC *query* by path. Covers read
3
+ * procedures not given a dedicated typed tool.
4
+ *
5
+ * Two guardrails keep this read-only:
6
+ * 1. Hard guarantee — `client.query()` issues an HTTP GET, and tRPC only serves
7
+ * *queries* over GET; a mutation path is rejected by the server.
8
+ * 2. Early rejection — we refuse paths whose last segment reads like a mutation
9
+ * verb, so the harness gets a clear message instead of a server error.
10
+ * There is deliberately NO `datar_mutate` tool in v1.
11
+ */
12
+ import type { ToolDef } from "../registry.js";
13
+ /** Returns a reason string if the path looks like a mutation, else null. */
14
+ export declare function rejectIfMutation(path: string): string | null;
15
+ export declare const queryTool: ToolDef;
16
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA2C9C,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU5D;AAED,eAAO,MAAM,SAAS,EAAE,OAqBtB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Generic read escape hatch — call ANY Datar tRPC *query* by path. Covers read
3
+ * procedures not given a dedicated typed tool.
4
+ *
5
+ * Two guardrails keep this read-only:
6
+ * 1. Hard guarantee — `client.query()` issues an HTTP GET, and tRPC only serves
7
+ * *queries* over GET; a mutation path is rejected by the server.
8
+ * 2. Early rejection — we refuse paths whose last segment reads like a mutation
9
+ * verb, so the harness gets a clear message instead of a server error.
10
+ * There is deliberately NO `datar_mutate` tool in v1.
11
+ */
12
+ import { z } from "zod";
13
+ import { tool } from "../registry.js";
14
+ /** Verbs that mark a tRPC procedure as a mutation in this codebase's naming. */
15
+ const MUTATION_VERBS = [
16
+ "create",
17
+ "update",
18
+ "delete",
19
+ "remove",
20
+ "publish",
21
+ "submit",
22
+ "approve",
23
+ "reject",
24
+ "send",
25
+ "set",
26
+ "add",
27
+ "archive",
28
+ "cancel",
29
+ "restore",
30
+ "star",
31
+ "move",
32
+ "generate",
33
+ "upload",
34
+ "confirm",
35
+ "share",
36
+ "reserve",
37
+ "release",
38
+ "fulfill",
39
+ "adjust",
40
+ "register",
41
+ "withdraw",
42
+ "invoke",
43
+ "complete",
44
+ "mark",
45
+ "flag",
46
+ "empty",
47
+ "revoke",
48
+ "seed",
49
+ "import",
50
+ "assign",
51
+ "provision",
52
+ ];
53
+ /** Returns a reason string if the path looks like a mutation, else null. */
54
+ export function rejectIfMutation(path) {
55
+ const last = path.split(".").pop()?.toLowerCase() ?? "";
56
+ const hit = MUTATION_VERBS.find((v) => last === v || last.startsWith(v));
57
+ if (hit) {
58
+ return `Refusing "${path}": segment "${last}" looks like a mutation (v1 is read-only). Use datar_ask for actions, or mint a write-scoped token in a future version.`;
59
+ }
60
+ if (!path.startsWith("v2.")) {
61
+ return `Refusing "${path}": expected a v2.* tRPC query path (e.g. "v2.drive.file.getCurrentUserFiles").`;
62
+ }
63
+ return null;
64
+ }
65
+ export const queryTool = tool({
66
+ name: "datar_query",
67
+ description: "Call any Datar tRPC *query* (read) by path, e.g. " +
68
+ "'v2.drive.file.getCurrentUserFiles'. Read-only: mutation paths are refused. " +
69
+ "Use datar_list_services / datar_describe_service to discover what exists.",
70
+ inputSchema: {
71
+ path: z
72
+ .string()
73
+ .describe("tRPC query path, e.g. 'v2.people.org.getActiveMembers'."),
74
+ input: z
75
+ .unknown()
76
+ .optional()
77
+ .describe("Optional input for the query (object or scalar)."),
78
+ },
79
+ handler: async (client, args) => {
80
+ const path = String(args.path);
81
+ const reason = rejectIfMutation(path);
82
+ if (reason)
83
+ throw new Error(reason);
84
+ return client.query(path, args.input);
85
+ },
86
+ });
87
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/mcp/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,gFAAgF;AAChF,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;IACN,KAAK;IACL,KAAK;IACL,SAAS;IACT,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,WAAW;CACZ,CAAC;AAEF,4EAA4E;AAC5E,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACxD,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,aAAa,IAAI,eAAe,IAAI,yHAAyH,CAAC;IACvK,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,aAAa,IAAI,gFAAgF,CAAC;IAC3G,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAY,IAAI,CAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,mDAAmD;QACnD,8EAA8E;QAC9E,2EAA2E;IAC7E,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,CAAC,yDAAyD,CAAC;QACtE,KAAK,EAAE,CAAC;aACL,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CAAC,kDAAkD,CAAC;KAChE;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Typed read tools — deterministic, 1:1 wrappers over `@datar-platform/sdk`
3
+ * read methods. Every handler calls only SDK read methods (tRPC GET). No
4
+ * mutations. These give the harness precise, schema'd access to the highest-
5
+ * value data without paying for a nested-LLM agent round-trip.
6
+ */
7
+ import type { ToolDef } from "../registry.js";
8
+ export declare const readTools: ToolDef[];
9
+ //# sourceMappingURL=reads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reads.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/reads.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAO9C,eAAO,MAAM,SAAS,EAAE,OAAO,EAsL9B,CAAC"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Typed read tools — deterministic, 1:1 wrappers over `@datar-platform/sdk`
3
+ * read methods. Every handler calls only SDK read methods (tRPC GET). No
4
+ * mutations. These give the harness precise, schema'd access to the highest-
5
+ * value data without paying for a nested-LLM agent round-trip.
6
+ */
7
+ import { z } from "zod";
8
+ import { tool } from "../registry.js";
9
+ const str = (v) => String(v);
10
+ const optStr = (v) => typeof v === "string" && v.length > 0 ? v : undefined;
11
+ export const readTools = [
12
+ // ── Drive ──────────────────────────────────────────────────────────────
13
+ tool({
14
+ name: "drive_list_files",
15
+ description: "List Drive files. With no folderId, returns the current user's files; " +
16
+ "pass a folderId to list a specific folder's contents.",
17
+ inputSchema: {
18
+ folderId: z
19
+ .string()
20
+ .optional()
21
+ .describe("Folder id, or omit for the user's files."),
22
+ },
23
+ handler: (client, args) => client.drive.listFiles(optStr(args.folderId)),
24
+ }),
25
+ tool({
26
+ name: "drive_get_file",
27
+ description: "Get a single Drive file's metadata by id.",
28
+ inputSchema: { id: z.string().describe("File id.") },
29
+ handler: (client, args) => client.drive.getFile(str(args.id)),
30
+ }),
31
+ tool({
32
+ name: "drive_list_folders",
33
+ description: "List Drive folders for the current user.",
34
+ inputSchema: {},
35
+ handler: (client) => client.drive.listFolders(),
36
+ }),
37
+ // ── Projects & tasks ───────────────────────────────────────────────────
38
+ tool({
39
+ name: "projects_list",
40
+ description: "List all projects in the org.",
41
+ inputSchema: {},
42
+ handler: (client) => client.projects.list(),
43
+ }),
44
+ tool({
45
+ name: "projects_get",
46
+ description: "Get one project by id.",
47
+ inputSchema: { id: z.string().describe("Project id.") },
48
+ handler: (client, args) => client.projects.get(str(args.id)),
49
+ }),
50
+ tool({
51
+ name: "projects_metrics",
52
+ description: "Get project portfolio metrics (totals, active projects, pending tasks, critical issues).",
53
+ inputSchema: {},
54
+ handler: (client) => client.projects.getMetrics(),
55
+ }),
56
+ tool({
57
+ name: "tasks_list",
58
+ description: "List tasks. Filter by projectId, or assignedToMe, or backlog; omit all for every task.",
59
+ inputSchema: {
60
+ projectId: z.string().optional(),
61
+ assignedToMe: z.boolean().optional(),
62
+ backlog: z.boolean().optional(),
63
+ },
64
+ handler: (client, args) => client.projects.tasks.list({
65
+ projectId: optStr(args.projectId),
66
+ assignedToMe: args.assignedToMe === true ? true : undefined,
67
+ backlog: args.backlog === true ? true : undefined,
68
+ }),
69
+ }),
70
+ // ── People ─────────────────────────────────────────────────────────────
71
+ tool({
72
+ name: "people_list",
73
+ description: "List active members of the org (the token's tenant).",
74
+ inputSchema: {},
75
+ handler: (client) => client.query("v2.people.org.getActiveMembers"),
76
+ }),
77
+ // ── Requests / approvals ───────────────────────────────────────────────
78
+ tool({
79
+ name: "requests_list",
80
+ description: "List all requests in the org.",
81
+ inputSchema: {},
82
+ handler: (client) => client.requests.getAll(),
83
+ }),
84
+ tool({
85
+ name: "requests_pending_approvals",
86
+ description: "List requests awaiting the current user's approval.",
87
+ inputSchema: {},
88
+ handler: (client) => client.requests.getCurrentUserPendingApprovals(),
89
+ }),
90
+ // ── Transact (accounts / transactions — e.g. PayFast-backed ledgers) ────
91
+ tool({
92
+ name: "transact_list_accounts",
93
+ description: "List the current user's accounts (expense/income/asset/liability).",
94
+ inputSchema: {},
95
+ handler: (client) => client.transact.listAccounts(),
96
+ }),
97
+ tool({
98
+ name: "transact_list_transactions",
99
+ description: "List transactions. Optionally filter by accountId, or by a startDate/endDate range (ISO dates).",
100
+ inputSchema: {
101
+ accountId: z.string().optional(),
102
+ startDate: z.string().optional(),
103
+ endDate: z.string().optional(),
104
+ },
105
+ handler: (client, args) => client.transact.listTransactions({
106
+ accountId: optStr(args.accountId),
107
+ startDate: optStr(args.startDate),
108
+ endDate: optStr(args.endDate),
109
+ }),
110
+ }),
111
+ // ── Procurement (tenders / suppliers) ──────────────────────────────────
112
+ tool({
113
+ name: "procurement_list_tenders",
114
+ description: "List the org's tenders (buyer side).",
115
+ inputSchema: {},
116
+ handler: (client) => client.procurement.listTenders(),
117
+ }),
118
+ tool({
119
+ name: "procurement_list_public_tenders",
120
+ description: "List published public tenders available to bid on (supplier side).",
121
+ inputSchema: {},
122
+ handler: (client) => client.procurement.listPublicTenders(),
123
+ }),
124
+ tool({
125
+ name: "procurement_list_suppliers",
126
+ description: "List registered suppliers.",
127
+ inputSchema: {},
128
+ handler: (client) => client.procurement.listSuppliers(),
129
+ }),
130
+ // ── Inventory ──────────────────────────────────────────────────────────
131
+ tool({
132
+ name: "inventory_list_items",
133
+ description: "List inventory items with stock levels.",
134
+ inputSchema: {},
135
+ handler: (client) => client.inventory.listItems(),
136
+ }),
137
+ tool({
138
+ name: "inventory_low_stock",
139
+ description: "List inventory items at or below their low-stock threshold.",
140
+ inputSchema: {},
141
+ handler: (client) => client.inventory.getLowStockItems(),
142
+ }),
143
+ // ── ISMS (risk / controls) ─────────────────────────────────────────────
144
+ tool({
145
+ name: "isms_list_risks",
146
+ description: "List the ISMS risk register.",
147
+ inputSchema: {},
148
+ handler: (client) => client.isms.listRisks(),
149
+ }),
150
+ tool({
151
+ name: "isms_list_controls",
152
+ description: "List ISMS controls and their implementation status.",
153
+ inputSchema: {},
154
+ handler: (client) => client.isms.listControls(),
155
+ }),
156
+ // ── Invoicing ──────────────────────────────────────────────────────────
157
+ tool({
158
+ name: "invoicing_list_invoices",
159
+ description: "List invoices.",
160
+ inputSchema: {},
161
+ handler: (client) => client.invoicing.listInvoices(),
162
+ }),
163
+ tool({
164
+ name: "invoicing_list_clients",
165
+ description: "List invoicing clients.",
166
+ inputSchema: {},
167
+ handler: (client) => client.invoicing.listClients(),
168
+ }),
169
+ // ── Messages ───────────────────────────────────────────────────────────
170
+ tool({
171
+ name: "messages_list",
172
+ description: "List the current user's messages/notifications.",
173
+ inputSchema: {},
174
+ handler: (client) => client.messages.list(),
175
+ }),
176
+ ];
177
+ //# sourceMappingURL=reads.js.map
@@ -0,0 +1 @@
1
+ {"version":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4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Datar CLI and MCP server — connect any AI harness (Claude Code, etc.) to a Datar org via an API token. Read + discovery in v1.",
7
+ "keywords": [
8
+ "datar",
9
+ "cli",
10
+ "mcp",
11
+ "model-context-protocol",
12
+ "ai",
13
+ "agents"
14
+ ],
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/joesome-Web-Services/datar-turbo.git",
19
+ "directory": "packages/cli"
20
+ },
21
+ "homepage": "https://datar.co.za",
22
+ "bin": {
23
+ "datar": "dist/index.js"
24
+ },
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./mcp": {
31
+ "types": "./dist/mcp/server.d.ts",
32
+ "default": "./dist/mcp/server.js"
33
+ },
34
+ "./mcp/tools": {
35
+ "types": "./dist/mcp/tools/index.d.ts",
36
+ "default": "./dist/mcp/tools/index.js"
37
+ },
38
+ "./mcp/registry": {
39
+ "types": "./dist/mcp/registry.d.ts",
40
+ "default": "./dist/mcp/registry.js"
41
+ },
42
+ "./config": {
43
+ "types": "./dist/config.d.ts",
44
+ "default": "./dist/config.js"
45
+ }
46
+ },
47
+ "main": "./dist/index.js",
48
+ "types": "./dist/index.d.ts",
49
+ "files": [
50
+ "dist",
51
+ "README.md"
52
+ ],
53
+ "publishConfig": {
54
+ "access": "public",
55
+ "registry": "https://registry.npmjs.org/"
56
+ },
57
+ "engines": {
58
+ "node": ">=20"
59
+ },
60
+ "dependencies": {
61
+ "@modelcontextprotocol/sdk": "^1.27.1",
62
+ "zod": "^4.1.12",
63
+ "@datar-platform/sdk": "0.3.0-alpha.3"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "^22.18.12",
67
+ "typescript": "^5.9.3",
68
+ "vitest": "^2.1.8",
69
+ "@joesome-web-services/tsconfig": "0.2.11"
70
+ },
71
+ "scripts": {
72
+ "build": "tsc",
73
+ "clean": "git clean -xdf .cache .turbo dist node_modules",
74
+ "dev": "tsc --watch",
75
+ "test": "vitest run",
76
+ "typecheck": "tsgo --noEmit --emitDeclarationOnly false"
77
+ }
78
+ }