@thenavidm/threads-mcp-cli 1.1.1 → 2.0.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.
@@ -1,51 +1,29 @@
1
1
  /**
2
- * Shared plumbing every tool uses.
2
+ * Shared plumbing every tool uses, now on Slipway.
3
3
  *
4
- * Registering thirty tools by hand is thirty chances to forget an annotation,
5
- * leak a stack trace, or return a shape the model cannot read. This wraps all
6
- * of it once so a tool module only describes what it actually does.
4
+ * Tool modules keep describing themselves with a Zod shape, a risk and a
5
+ * handler. This adapter turns each into a Slipway tool, so the MCP server, the
6
+ * CLI, the write guard, annotations and errors all come from the framework
7
+ * instead of a copy kept in this repo.
7
8
  */
8
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
- import { z, type ZodRawShape } from "zod";
9
+ import { z, type Risk, type SlipwayError, type Tool } from "@thenavidm/slipway";
10
10
  import type { ThreadsClient } from "../api/client.js";
11
+ import { ThreadsError } from "../api/errors.js";
11
12
  import type { Account, Config } from "../config.js";
12
- import { type Risk, type WriteGuard } from "../safety.js";
13
13
  export type ToolContext = {
14
14
  client: ThreadsClient;
15
15
  config: Config;
16
- guard: WriteGuard;
17
16
  /** Resolve which profile this call acts as. */
18
17
  account: (hint?: string) => Account;
19
18
  };
20
- export type ToolResult = {
21
- content: {
22
- type: "text";
23
- text: string;
24
- }[];
25
- isError?: boolean;
26
- };
27
- /**
28
- * A tool returns either a pre-rendered string or a value to serialise.
29
- *
30
- * The reading tools return the tagged format from `format/posts.ts`, which is
31
- * already text. The writing tools return a small object, an id and a permalink,
32
- * where JSON is clearer than tags. Both go through here so neither has to think
33
- * about the MCP content envelope.
34
- */
35
- export declare function ok(data: unknown): ToolResult;
36
- /**
37
- * Errors come back as a normal result with `isError`, not a thrown exception.
38
- *
39
- * A thrown MCP error reaches the model as a protocol failure with no structure.
40
- * A result it can read tells it what went wrong and usually how to fix it,
41
- * which is the difference between a correct retry and a give-up.
42
- */
43
- export declare function fail(error: unknown): ToolResult;
44
19
  /** The optional argument that picks a profile, on every account-scoped tool. */
45
20
  export declare const accountArg: {
46
21
  account: z.ZodOptional<z.ZodString>;
47
22
  };
48
- /** The confirmation argument required by every public or irreversible tool. */
23
+ /**
24
+ * Kept so tool modules read the same, but never sent: Slipway adds `confirm`
25
+ * to every irreversible tool itself, with one description everywhere.
26
+ */
49
27
  export declare const confirmArg: {
50
28
  confirm: z.ZodOptional<z.ZodBoolean>;
51
29
  };
@@ -54,7 +32,8 @@ export declare const pageArgs: {
54
32
  limit: z.ZodOptional<z.ZodNumber>;
55
33
  cursor: z.ZodOptional<z.ZodString>;
56
34
  };
57
- export type ToolSpec<S extends ZodRawShape> = {
35
+ type Shape = Record<string, z.ZodType>;
36
+ export type ToolSpec<S extends Shape> = {
58
37
  name: string;
59
38
  /** One line, imperative. Shown in tool pickers. */
60
39
  title: string;
@@ -67,24 +46,19 @@ export type ToolSpec<S extends ZodRawShape> = {
67
46
  /** One line for the audit log and the confirm message, when this is a write. */
68
47
  summary?: (args: z.infer<z.ZodObject<S>>) => string;
69
48
  };
70
- export declare function defineTool<S extends ZodRawShape>(spec: ToolSpec<S>): ToolSpec<S>;
49
+ export type AnyToolSpec = Tool<ToolContext>;
71
50
  /**
72
- * A tool of any shape, for the one place tools are held together in a list.
73
- *
74
- * `ToolSpec` is generic over its schema, so a list of tools with different
75
- * schemas has no single type: each handler takes a different argument shape and
76
- * function parameters are contravariant. The type safety that matters lives
77
- * inside each `defineTool` call, where schema and handler are checked against
78
- * each other. This only loosens the seam where they are collected.
51
+ * Meta answers almost every failure with HTTP 400, an expired token and a
52
+ * spent quota included, and puts what happened in `code` and `error_subcode`.
53
+ * `api/errors.ts` already sorts them into classes, so the exit code and error
54
+ * code follow the class, not the status, and Meta's own fields ride along in
55
+ * `details` for the model to read.
79
56
  */
80
- export type AnyToolSpec = Omit<ToolSpec<ZodRawShape>, "handler" | "summary"> & {
81
- handler: (args: never, ctx: ToolContext) => Promise<unknown>;
82
- summary?: (args: never) => string;
83
- };
84
- /** Register one tool against the server, with guarding and error handling applied. */
85
- export declare function register(server: McpServer, contextFor: (extra: unknown) => ToolContext, spec: AnyToolSpec): void;
86
- export declare function makeContext(client: ThreadsClient, config: Config, guard: WriteGuard): ToolContext;
57
+ export declare function toSlipway(error: ThreadsError): SlipwayError;
58
+ export declare function defineTool<S extends Shape>(spec: ToolSpec<S>): Tool<ToolContext>;
59
+ export declare function makeContext(client: ThreadsClient, config: Config): ToolContext;
87
60
  /** Clamp a caller-supplied limit into a range Threads will accept. */
88
61
  export declare function clamp(value: number | undefined, fallback: number, max?: number): number;
89
62
  /** Trim a summary to one readable line for the audit log. */
90
63
  export declare function snippet(text: string | undefined, length?: number): string;
64
+ export {};
package/dist/tools/kit.js CHANGED
@@ -1,39 +1,15 @@
1
1
  /**
2
- * Shared plumbing every tool uses.
2
+ * Shared plumbing every tool uses, now on Slipway.
3
3
  *
4
- * Registering thirty tools by hand is thirty chances to forget an annotation,
5
- * leak a stack trace, or return a shape the model cannot read. This wraps all
6
- * of it once so a tool module only describes what it actually does.
4
+ * Tool modules keep describing themselves with a Zod shape, a risk and a
5
+ * handler. This adapter turns each into a Slipway tool, so the MCP server, the
6
+ * CLI, the write guard, annotations and errors all come from the framework
7
+ * instead of a copy kept in this repo.
7
8
  */
8
- import { z } from "zod";
9
- import { ThreadsError } from "../api/errors.js";
9
+ import { ApiError, AuthError, NotFoundError as SlipwayNotFound, RateLimitError as SlipwayRateLimit, RefusedError, TimeoutError as SlipwayTimeout, toolkit, UsageError, z, } from "@thenavidm/slipway";
10
+ import { AuthenticationError, NotFoundError, PermissionError, RateLimitError, TextTooLongError, ThreadsError, TimeoutError, ValidationError, WriteBlockedError, } from "../api/errors.js";
10
11
  import { selectAccount } from "../config.js";
11
- import { annotationsFor } from "../safety.js";
12
- /**
13
- * A tool returns either a pre-rendered string or a value to serialise.
14
- *
15
- * The reading tools return the tagged format from `format/posts.ts`, which is
16
- * already text. The writing tools return a small object, an id and a permalink,
17
- * where JSON is clearer than tags. Both go through here so neither has to think
18
- * about the MCP content envelope.
19
- */
20
- export function ok(data) {
21
- const text = typeof data === "string" ? data : JSON.stringify(data, null, 2);
22
- return { content: [{ type: "text", text }] };
23
- }
24
- /**
25
- * Errors come back as a normal result with `isError`, not a thrown exception.
26
- *
27
- * A thrown MCP error reaches the model as a protocol failure with no structure.
28
- * A result it can read tells it what went wrong and usually how to fix it,
29
- * which is the difference between a correct retry and a give-up.
30
- */
31
- export function fail(error) {
32
- const payload = error instanceof ThreadsError
33
- ? error.toJSON()
34
- : { error: error?.message ?? String(error) };
35
- return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }], isError: true };
36
- }
12
+ const kit = toolkit();
37
13
  /** The optional argument that picks a profile, on every account-scoped tool. */
38
14
  export const accountArg = {
39
15
  account: z
@@ -41,67 +17,76 @@ export const accountArg = {
41
17
  .optional()
42
18
  .describe("Which connected Threads profile to act as, by username (for example 'thenavidm'). Defaults to the first connected profile. Call list_accounts to see them."),
43
19
  };
44
- /** The confirmation argument required by every public or irreversible tool. */
20
+ /**
21
+ * Kept so tool modules read the same, but never sent: Slipway adds `confirm`
22
+ * to every irreversible tool itself, with one description everywhere.
23
+ */
45
24
  export const confirmArg = {
46
- confirm: z
47
- .boolean()
48
- .optional()
49
- .describe("Must be true for this to run. The result is public immediately or cannot be undone, so it is refused without an explicit confirmation. Threads has no edit endpoint and no unsend."),
25
+ confirm: z.boolean().optional(),
50
26
  };
51
27
  /** Cursor and limit, on every paginating tool. */
52
28
  export const pageArgs = {
53
- limit: z
54
- .number()
55
- .int()
56
- .min(1)
57
- .max(100)
58
- .optional()
59
- .describe("How many to return, 1-100."),
29
+ limit: z.number().int().min(1).max(100).optional().describe("How many to return, 1-100."),
60
30
  cursor: z
61
31
  .string()
62
32
  .optional()
63
33
  .describe("Continue from a previous page. Pass the `cursor` attribute from the last result."),
64
34
  };
65
- export function defineTool(spec) {
66
- return spec;
35
+ /**
36
+ * Meta answers almost every failure with HTTP 400, an expired token and a
37
+ * spent quota included, and puts what happened in `code` and `error_subcode`.
38
+ * `api/errors.ts` already sorts them into classes, so the exit code and error
39
+ * code follow the class, not the status, and Meta's own fields ride along in
40
+ * `details` for the model to read.
41
+ */
42
+ export function toSlipway(error) {
43
+ const details = Object.fromEntries(Object.entries({
44
+ endpoint: error.endpoint,
45
+ meta_code: error.code || undefined,
46
+ meta_subcode: error.subcode || undefined,
47
+ meta_type: error.type || undefined,
48
+ detail: error.detail || undefined,
49
+ trace_id: error.traceId || undefined,
50
+ }).filter(([, value]) => value !== undefined));
51
+ const options = { ...(error.status ? { status: error.status } : {}), details, cause: error };
52
+ if (error instanceof AuthenticationError || error instanceof PermissionError)
53
+ return new AuthError(error.message, options);
54
+ if (error instanceof NotFoundError)
55
+ return new SlipwayNotFound(error.message, options);
56
+ if (error instanceof RateLimitError)
57
+ return new SlipwayRateLimit(error.message, options);
58
+ if (error instanceof ValidationError || error instanceof TextTooLongError)
59
+ return new UsageError(error.message, options);
60
+ if (error instanceof WriteBlockedError)
61
+ return new RefusedError(error.message, options);
62
+ if (error instanceof TimeoutError)
63
+ return new SlipwayTimeout(error.message, options);
64
+ // A server error, a container that never finished processing, or no answer at all: the service's failure, worth a retry.
65
+ return new ApiError(error.message, options);
67
66
  }
68
- /** Register one tool against the server, with guarding and error handling applied. */
69
- export function register(server, contextFor, spec) {
70
- server.registerTool(spec.name, {
67
+ export function defineTool(spec) {
68
+ const { confirm: _confirm, ...shape } = spec.schema;
69
+ const handler = spec.handler;
70
+ return kit.defineTool({
71
+ name: spec.name,
71
72
  title: spec.title,
72
73
  description: spec.description,
73
- inputSchema: spec.schema,
74
- annotations: {
75
- title: spec.title,
76
- ...annotationsFor(spec.risk, { idempotent: spec.idempotent }),
77
- },
78
- },
79
- // The SDK derives its callback type from the schema generic. This wrapper is
80
- // generic over the same shape, but TypeScript cannot prove the two are equal
81
- // through the indirection, so the cast lives at this single boundary rather
82
- // than in every tool definition.
83
- (async (args, extra) => {
84
- try {
85
- const ctx = contextFor(extra);
86
- if (spec.risk !== "read") {
87
- const summary = spec.summary?.(args) ?? spec.name;
88
- const confirm = args.confirm;
89
- ctx.guard.check(spec.name, spec.risk, confirm, summary);
74
+ input: z.object(shape),
75
+ risk: spec.risk,
76
+ ...(spec.idempotent !== undefined ? { idempotent: spec.idempotent } : {}),
77
+ ...(spec.summary ? { summary: spec.summary } : {}),
78
+ handler: async (args, ctx) => {
79
+ try {
80
+ return await handler(args, ctx);
90
81
  }
91
- return ok(await spec.handler(args, ctx));
92
- }
93
- catch (error) {
94
- return fail(error);
95
- }
96
- }));
82
+ catch (error) {
83
+ throw error instanceof ThreadsError ? toSlipway(error) : error;
84
+ }
85
+ },
86
+ });
97
87
  }
98
- export function makeContext(client, config, guard) {
99
- return {
100
- client,
101
- config,
102
- guard,
103
- account: (hint) => selectAccount(config, hint),
104
- };
88
+ export function makeContext(client, config) {
89
+ return { client, config, account: (hint) => selectAccount(config, hint) };
105
90
  }
106
91
  /** Clamp a caller-supplied limit into a range Threads will accept. */
107
92
  export function clamp(value, fallback, max = 100) {
@@ -1 +1 @@
1
- {"version":3,"file":"kit.js","sourceRoot":"","sources":["../../src/tools/kit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,CAAC,EAAoB,MAAM,KAAK,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAA8B,MAAM,cAAc,CAAC;AAe1E;;;;;;;GAOG;AACH,MAAM,UAAU,EAAE,CAAC,IAAa;IAC9B,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7E,OAAO,EAAE,OAAO,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AAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,OAAO,CAAC,IAAwB,EAAE,MAAM,GAAG,EAAE;IAC3D,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,OAAO,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC"}
@@ -7,164 +7,13 @@
7
7
  * has: invisible, valid for 24 hours, publishable later by id. That is exactly
8
8
  * what an agent needs when a human wants to see something before it is public.
9
9
  */
10
- import { z } from "zod";
11
- export declare const createPost: import("./kit.js").ToolSpec<{
12
- confirm: z.ZodOptional<z.ZodBoolean>;
13
- account: z.ZodOptional<z.ZodString>;
14
- link_attachment: z.ZodOptional<z.ZodString>;
15
- topic_tag: z.ZodOptional<z.ZodString>;
16
- reply_to_id: z.ZodOptional<z.ZodString>;
17
- quote_post_id: z.ZodOptional<z.ZodString>;
18
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
19
- allowlisted_country_codes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
- enable_reply_approvals: z.ZodOptional<z.ZodBoolean>;
21
- image_url: z.ZodOptional<z.ZodString>;
22
- video_url: z.ZodOptional<z.ZodString>;
23
- alt_text: z.ZodOptional<z.ZodString>;
24
- text: z.ZodOptional<z.ZodString>;
25
- }>;
26
- export declare const createThread: import("./kit.js").ToolSpec<{
27
- confirm: z.ZodOptional<z.ZodBoolean>;
28
- account: z.ZodOptional<z.ZodString>;
29
- link_attachment: z.ZodOptional<z.ZodString>;
30
- topic_tag: z.ZodOptional<z.ZodString>;
31
- reply_to_id: z.ZodOptional<z.ZodString>;
32
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
33
- image_url: z.ZodOptional<z.ZodString>;
34
- video_url: z.ZodOptional<z.ZodString>;
35
- alt_text: z.ZodOptional<z.ZodString>;
36
- posts: z.ZodArray<z.ZodString, "many">;
37
- }>;
38
- export declare const createCarousel: import("./kit.js").ToolSpec<{
39
- confirm: z.ZodOptional<z.ZodBoolean>;
40
- account: z.ZodOptional<z.ZodString>;
41
- items: z.ZodArray<z.ZodObject<{
42
- image_url: z.ZodOptional<z.ZodString>;
43
- video_url: z.ZodOptional<z.ZodString>;
44
- alt_text: z.ZodOptional<z.ZodString>;
45
- }, "strip", z.ZodTypeAny, {
46
- alt_text?: string | undefined;
47
- image_url?: string | undefined;
48
- video_url?: string | undefined;
49
- }, {
50
- alt_text?: string | undefined;
51
- image_url?: string | undefined;
52
- video_url?: string | undefined;
53
- }>, "many">;
54
- text: z.ZodOptional<z.ZodString>;
55
- topic_tag: z.ZodOptional<z.ZodString>;
56
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
57
- }>;
58
- export declare const stagePost: import("./kit.js").ToolSpec<{
59
- account: z.ZodOptional<z.ZodString>;
60
- link_attachment: z.ZodOptional<z.ZodString>;
61
- topic_tag: z.ZodOptional<z.ZodString>;
62
- reply_to_id: z.ZodOptional<z.ZodString>;
63
- quote_post_id: z.ZodOptional<z.ZodString>;
64
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
65
- allowlisted_country_codes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
66
- enable_reply_approvals: z.ZodOptional<z.ZodBoolean>;
67
- image_url: z.ZodOptional<z.ZodString>;
68
- video_url: z.ZodOptional<z.ZodString>;
69
- alt_text: z.ZodOptional<z.ZodString>;
70
- text: z.ZodOptional<z.ZodString>;
71
- }>;
72
- export declare const publishStaged: import("./kit.js").ToolSpec<{
73
- confirm: z.ZodOptional<z.ZodBoolean>;
74
- account: z.ZodOptional<z.ZodString>;
75
- container_id: z.ZodString;
76
- }>;
77
- export declare const getContainerStatus: import("./kit.js").ToolSpec<{
78
- account: z.ZodOptional<z.ZodString>;
79
- container_id: z.ZodString;
80
- }>;
81
- export declare const quotePost: import("./kit.js").ToolSpec<{
82
- confirm: z.ZodOptional<z.ZodBoolean>;
83
- account: z.ZodOptional<z.ZodString>;
84
- text: z.ZodString;
85
- quoted_post_id: z.ZodString;
86
- }>;
87
- export declare const repost: import("./kit.js").ToolSpec<{
88
- confirm: z.ZodOptional<z.ZodBoolean>;
89
- account: z.ZodOptional<z.ZodString>;
90
- id: z.ZodString;
91
- }>;
92
- export declare const deletePost: import("./kit.js").ToolSpec<{
93
- confirm: z.ZodOptional<z.ZodBoolean>;
94
- account: z.ZodOptional<z.ZodString>;
95
- id: z.ZodString;
96
- }>;
97
- export declare const POST_TOOLS: (import("./kit.js").ToolSpec<{
98
- confirm: z.ZodOptional<z.ZodBoolean>;
99
- account: z.ZodOptional<z.ZodString>;
100
- link_attachment: z.ZodOptional<z.ZodString>;
101
- topic_tag: z.ZodOptional<z.ZodString>;
102
- reply_to_id: z.ZodOptional<z.ZodString>;
103
- quote_post_id: z.ZodOptional<z.ZodString>;
104
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
105
- allowlisted_country_codes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
106
- enable_reply_approvals: z.ZodOptional<z.ZodBoolean>;
107
- image_url: z.ZodOptional<z.ZodString>;
108
- video_url: z.ZodOptional<z.ZodString>;
109
- alt_text: z.ZodOptional<z.ZodString>;
110
- text: z.ZodOptional<z.ZodString>;
111
- }> | import("./kit.js").ToolSpec<{
112
- confirm: z.ZodOptional<z.ZodBoolean>;
113
- account: z.ZodOptional<z.ZodString>;
114
- link_attachment: z.ZodOptional<z.ZodString>;
115
- topic_tag: z.ZodOptional<z.ZodString>;
116
- reply_to_id: z.ZodOptional<z.ZodString>;
117
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
118
- image_url: z.ZodOptional<z.ZodString>;
119
- video_url: z.ZodOptional<z.ZodString>;
120
- alt_text: z.ZodOptional<z.ZodString>;
121
- posts: z.ZodArray<z.ZodString, "many">;
122
- }> | import("./kit.js").ToolSpec<{
123
- confirm: z.ZodOptional<z.ZodBoolean>;
124
- account: z.ZodOptional<z.ZodString>;
125
- items: z.ZodArray<z.ZodObject<{
126
- image_url: z.ZodOptional<z.ZodString>;
127
- video_url: z.ZodOptional<z.ZodString>;
128
- alt_text: z.ZodOptional<z.ZodString>;
129
- }, "strip", z.ZodTypeAny, {
130
- alt_text?: string | undefined;
131
- image_url?: string | undefined;
132
- video_url?: string | undefined;
133
- }, {
134
- alt_text?: string | undefined;
135
- image_url?: string | undefined;
136
- video_url?: string | undefined;
137
- }>, "many">;
138
- text: z.ZodOptional<z.ZodString>;
139
- topic_tag: z.ZodOptional<z.ZodString>;
140
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
141
- }> | import("./kit.js").ToolSpec<{
142
- account: z.ZodOptional<z.ZodString>;
143
- link_attachment: z.ZodOptional<z.ZodString>;
144
- topic_tag: z.ZodOptional<z.ZodString>;
145
- reply_to_id: z.ZodOptional<z.ZodString>;
146
- quote_post_id: z.ZodOptional<z.ZodString>;
147
- reply_control: z.ZodOptional<z.ZodEnum<["everyone", "accounts_you_follow", "mentioned_only", "parent_post_author_only", "followers_only"]>>;
148
- allowlisted_country_codes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
149
- enable_reply_approvals: z.ZodOptional<z.ZodBoolean>;
150
- image_url: z.ZodOptional<z.ZodString>;
151
- video_url: z.ZodOptional<z.ZodString>;
152
- alt_text: z.ZodOptional<z.ZodString>;
153
- text: z.ZodOptional<z.ZodString>;
154
- }> | import("./kit.js").ToolSpec<{
155
- confirm: z.ZodOptional<z.ZodBoolean>;
156
- account: z.ZodOptional<z.ZodString>;
157
- container_id: z.ZodString;
158
- }> | import("./kit.js").ToolSpec<{
159
- account: z.ZodOptional<z.ZodString>;
160
- container_id: z.ZodString;
161
- }> | import("./kit.js").ToolSpec<{
162
- confirm: z.ZodOptional<z.ZodBoolean>;
163
- account: z.ZodOptional<z.ZodString>;
164
- text: z.ZodString;
165
- quoted_post_id: z.ZodString;
166
- }> | import("./kit.js").ToolSpec<{
167
- confirm: z.ZodOptional<z.ZodBoolean>;
168
- account: z.ZodOptional<z.ZodString>;
169
- id: z.ZodString;
170
- }>)[];
10
+ export declare const createPost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
11
+ export declare const createThread: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
12
+ export declare const createCarousel: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
13
+ export declare const stagePost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
14
+ export declare const publishStaged: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
15
+ export declare const getContainerStatus: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
16
+ export declare const quotePost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
17
+ export declare const repost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
18
+ export declare const deletePost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
19
+ export declare const POST_TOOLS: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>[];
@@ -5,27 +5,6 @@
5
5
  * because "what did I post this week" is a question about time and turning it
6
6
  * into a guess at a post count is how you end up missing half of it.
7
7
  */
8
- import { z } from "zod";
9
- export declare const getPosts: import("./kit.js").ToolSpec<{
10
- account: z.ZodOptional<z.ZodString>;
11
- limit: z.ZodOptional<z.ZodNumber>;
12
- cursor: z.ZodOptional<z.ZodString>;
13
- since_hours: z.ZodOptional<z.ZodNumber>;
14
- since: z.ZodOptional<z.ZodString>;
15
- until: z.ZodOptional<z.ZodString>;
16
- }>;
17
- export declare const getPost: import("./kit.js").ToolSpec<{
18
- account: z.ZodOptional<z.ZodString>;
19
- id: z.ZodString;
20
- }>;
21
- export declare const READ_TOOLS: (import("./kit.js").ToolSpec<{
22
- account: z.ZodOptional<z.ZodString>;
23
- limit: z.ZodOptional<z.ZodNumber>;
24
- cursor: z.ZodOptional<z.ZodString>;
25
- since_hours: z.ZodOptional<z.ZodNumber>;
26
- since: z.ZodOptional<z.ZodString>;
27
- until: z.ZodOptional<z.ZodString>;
28
- }> | import("./kit.js").ToolSpec<{
29
- account: z.ZodOptional<z.ZodString>;
30
- id: z.ZodString;
31
- }>)[];
8
+ export declare const getPosts: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
9
+ export declare const getPost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
10
+ export declare const READ_TOOLS: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>[];
@@ -11,82 +11,11 @@
11
11
  * The third is the one an agent actually wants when asked "what needs
12
12
  * answering", and it is the one nothing surfaces by default.
13
13
  */
14
- import { z } from "zod";
15
- export declare const replyToPost: import("./kit.js").ToolSpec<{
16
- confirm: z.ZodOptional<z.ZodBoolean>;
17
- account: z.ZodOptional<z.ZodString>;
18
- id: z.ZodString;
19
- text: z.ZodString;
20
- image_url: z.ZodOptional<z.ZodString>;
21
- video_url: z.ZodOptional<z.ZodString>;
22
- alt_text: z.ZodOptional<z.ZodString>;
23
- }>;
24
- export declare const getReplies: import("./kit.js").ToolSpec<{
25
- account: z.ZodOptional<z.ZodString>;
26
- limit: z.ZodOptional<z.ZodNumber>;
27
- cursor: z.ZodOptional<z.ZodString>;
28
- id: z.ZodString;
29
- reverse: z.ZodOptional<z.ZodBoolean>;
30
- }>;
31
- export declare const getConversation: import("./kit.js").ToolSpec<{
32
- account: z.ZodOptional<z.ZodString>;
33
- limit: z.ZodOptional<z.ZodNumber>;
34
- cursor: z.ZodOptional<z.ZodString>;
35
- id: z.ZodString;
36
- reverse: z.ZodOptional<z.ZodBoolean>;
37
- }>;
38
- export declare const getAllReplies: import("./kit.js").ToolSpec<{
39
- account: z.ZodOptional<z.ZodString>;
40
- limit: z.ZodOptional<z.ZodNumber>;
41
- cursor: z.ZodOptional<z.ZodString>;
42
- since_hours: z.ZodOptional<z.ZodNumber>;
43
- }>;
44
- export declare const hideReply: import("./kit.js").ToolSpec<{
45
- account: z.ZodOptional<z.ZodString>;
46
- reply_id: z.ZodString;
47
- hide: z.ZodOptional<z.ZodBoolean>;
48
- }>;
49
- export declare const getPendingReplies: import("./kit.js").ToolSpec<{
50
- account: z.ZodOptional<z.ZodString>;
51
- limit: z.ZodOptional<z.ZodNumber>;
52
- cursor: z.ZodOptional<z.ZodString>;
53
- }>;
54
- export declare const managePendingReply: import("./kit.js").ToolSpec<{
55
- confirm: z.ZodOptional<z.ZodBoolean>;
56
- account: z.ZodOptional<z.ZodString>;
57
- reply_id: z.ZodString;
58
- action: z.ZodEnum<["approve", "ignore"]>;
59
- }>;
60
- export declare const REPLY_TOOLS: (import("./kit.js").ToolSpec<{
61
- confirm: z.ZodOptional<z.ZodBoolean>;
62
- account: z.ZodOptional<z.ZodString>;
63
- id: z.ZodString;
64
- text: z.ZodString;
65
- image_url: z.ZodOptional<z.ZodString>;
66
- video_url: z.ZodOptional<z.ZodString>;
67
- alt_text: z.ZodOptional<z.ZodString>;
68
- }> | import("./kit.js").ToolSpec<{
69
- account: z.ZodOptional<z.ZodString>;
70
- limit: z.ZodOptional<z.ZodNumber>;
71
- cursor: z.ZodOptional<z.ZodString>;
72
- id: z.ZodString;
73
- reverse: z.ZodOptional<z.ZodBoolean>;
74
- }> | import("./kit.js").ToolSpec<{
75
- account: z.ZodOptional<z.ZodString>;
76
- limit: z.ZodOptional<z.ZodNumber>;
77
- cursor: z.ZodOptional<z.ZodString>;
78
- since_hours: z.ZodOptional<z.ZodNumber>;
79
- }> | import("./kit.js").ToolSpec<{
80
- account: z.ZodOptional<z.ZodString>;
81
- reply_id: z.ZodString;
82
- hide: z.ZodOptional<z.ZodBoolean>;
83
- }> | import("./kit.js").ToolSpec<{
84
- account: z.ZodOptional<z.ZodString>;
85
- limit: z.ZodOptional<z.ZodNumber>;
86
- cursor: z.ZodOptional<z.ZodString>;
87
- }> | import("./kit.js").ToolSpec<{
88
- confirm: z.ZodOptional<z.ZodBoolean>;
89
- account: z.ZodOptional<z.ZodString>;
90
- reply_id: z.ZodString;
91
- action: z.ZodEnum<["approve", "ignore"]>;
92
- }>)[];
14
+ export declare const replyToPost: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
15
+ export declare const getReplies: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
16
+ export declare const getConversation: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
17
+ export declare const getAllReplies: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
18
+ export declare const hideReply: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
19
+ export declare const getPendingReplies: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
20
+ export declare const managePendingReply: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>;
21
+ export declare const REPLY_TOOLS: import("@thenavidm/slipway").Tool<import("./kit.js").ToolContext>[];