@tickernelz/paperclip-pro-mcp-server 2026.925.0 → 2026.925.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.
@@ -0,0 +1,195 @@
1
+ {
2
+ "DELETE /api/agents/{id}/keys/{keyId}": "credential_surface",
3
+ "DELETE /api/agents/me/secret-proposals/{id}": "credential_surface",
4
+ "DELETE /api/board-api-keys/{keyId}": "credential_surface",
5
+ "DELETE /api/companies/{companyId}/me/user-secrets/{secretId}": "credential_surface",
6
+ "DELETE /api/companies/{companyId}/skills/{skillId}/files": "non_json_response",
7
+ "DELETE /api/companies/{companyId}/user-secret-definitions/{definitionId}": "credential_surface",
8
+ "DELETE /api/issues/{id}/approvals/{approvalId}": "curated:paperclipUnlinkIssueApproval",
9
+ "DELETE /api/mcp/paperclip": "protocol",
10
+ "DELETE /api/secret-provider-configs/{id}": "credential_surface",
11
+ "DELETE /api/secrets/{id}": "credential_surface",
12
+ "GET /api/_plugins/{pluginId}/ui/{filePath}": "protocol",
13
+ "GET /api/adapters/{type}/ui-parser.js": "non_json_response",
14
+ "GET /api/agent-avatars/{version}/{palette}/{file}": "actor:public",
15
+ "GET /api/agents/{id}": "curated:paperclipGetAgent",
16
+ "GET /api/agents/{id}/keys": "credential_surface",
17
+ "GET /api/agents/me": "curated:paperclipMe",
18
+ "GET /api/agents/me/inbox-lite": "curated:paperclipInboxLite",
19
+ "GET /api/agents/me/secret-proposals": "credential_surface",
20
+ "GET /api/agents/me/secrets": "credential_surface",
21
+ "GET /api/approvals/{id}": "curated:paperclipGetApproval",
22
+ "GET /api/approvals/{id}/comments": "curated:paperclipListApprovalComments",
23
+ "GET /api/approvals/{id}/issues": "curated:paperclipGetApprovalIssues",
24
+ "GET /api/assets/{assetId}/content": "non_json_response",
25
+ "GET /api/attachments/{attachmentId}/content": "non_json_response",
26
+ "GET /api/auth/get-session": "protocol",
27
+ "GET /api/auth/profile": "protocol",
28
+ "GET /api/board-api-keys": "credential_surface",
29
+ "GET /api/board-claim/{token}": "actor:public",
30
+ "GET /api/cases/{caseId}/events": "protocol",
31
+ "GET /api/cases/{id}/events": "protocol",
32
+ "GET /api/cli-auth/challenges/{id}": "actor:public",
33
+ "GET /api/cli-auth/me": "protocol",
34
+ "GET /api/companies/{companyId}/agents": "curated:paperclipListAgents",
35
+ "GET /api/companies/{companyId}/approvals": "curated:paperclipListApprovals",
36
+ "GET /api/companies/{companyId}/audit/agent-actions.csv": "non_json_response",
37
+ "GET /api/companies/{companyId}/decision-training/export.jsonl": "non_json_response",
38
+ "GET /api/companies/{companyId}/goals": "curated:paperclipListGoals",
39
+ "GET /api/companies/{companyId}/invites": "credential_surface",
40
+ "GET /api/companies/{companyId}/issues": "curated:paperclipListIssues",
41
+ "GET /api/companies/{companyId}/join-requests": "credential_surface",
42
+ "GET /api/companies/{companyId}/me/user-secrets": "credential_surface",
43
+ "GET /api/companies/{companyId}/org.png": "non_json_response",
44
+ "GET /api/companies/{companyId}/org.svg": "non_json_response",
45
+ "GET /api/companies/{companyId}/projects": "curated:paperclipListProjects",
46
+ "GET /api/companies/{companyId}/secret-proposals": "credential_surface",
47
+ "GET /api/companies/{companyId}/secret-provider-configs": "credential_surface",
48
+ "GET /api/companies/{companyId}/secrets": "credential_surface",
49
+ "GET /api/companies/{companyId}/secrets/catalog": "credential_surface",
50
+ "GET /api/companies/{companyId}/setup-token-login-sessions/{sessionId}": "credential_surface",
51
+ "GET /api/companies/{companyId}/setup-token-login-sessions/{sessionId}/prompt": "credential_surface",
52
+ "GET /api/companies/{companyId}/setup-token-login-sessions/active": "credential_surface",
53
+ "GET /api/companies/{companyId}/skills": "curated:paperclipListSkills",
54
+ "GET /api/companies/{companyId}/skills/{skillId}/files": "non_json_response",
55
+ "GET /api/companies/{companyId}/smoke-lab/oauth/authorize": "protocol",
56
+ "GET /api/companies/{companyId}/smoke-lab/oauth/userinfo": "protocol",
57
+ "GET /api/companies/{companyId}/user-secret-definitions": "credential_surface",
58
+ "GET /api/companies/{companyId}/user-secret-definitions/{definitionId}/coverage": "credential_surface",
59
+ "GET /api/goals/{id}": "curated:paperclipGetGoal",
60
+ "GET /api/health": "actor:public",
61
+ "GET /api/heartbeat-runs/{runId}/events": "protocol",
62
+ "GET /api/heartbeat-runs/{runId}/provider-trace/download": "non_json_response",
63
+ "GET /api/invites/{token}": "actor:public",
64
+ "GET /api/invites/{token}/logo": "actor:public",
65
+ "GET /api/invites/{token}/onboarding": "actor:public",
66
+ "GET /api/invites/{token}/onboarding.txt": "actor:public",
67
+ "GET /api/invites/{token}/skills/{skillName}": "actor:public",
68
+ "GET /api/invites/{token}/skills/index": "actor:public",
69
+ "GET /api/invites/{token}/test-resolution": "actor:public",
70
+ "GET /api/issues/{id}": "curated:paperclipGetIssue",
71
+ "GET /api/issues/{id}/approvals": "curated:paperclipListIssueApprovals",
72
+ "GET /api/issues/{id}/comments": "curated:paperclipListComments",
73
+ "GET /api/issues/{id}/comments/{commentId}": "curated:paperclipGetComment",
74
+ "GET /api/issues/{id}/documents": "curated:paperclipListDocuments",
75
+ "GET /api/issues/{id}/documents/{key}": "curated:paperclipGetDocument",
76
+ "GET /api/issues/{id}/documents/{key}/pdf": "non_json_response",
77
+ "GET /api/issues/{id}/documents/{key}/revisions": "curated:paperclipListDocumentRevisions",
78
+ "GET /api/issues/{id}/heartbeat-context": "curated:paperclipGetHeartbeatContext",
79
+ "GET /api/issues/{issueId}/file-resources/content": "non_json_response",
80
+ "GET /api/llms/agent-configuration.txt": "non_json_response",
81
+ "GET /api/llms/agent-configuration/{adapterType}.txt": "non_json_response",
82
+ "GET /api/llms/agent-icons.txt": "non_json_response",
83
+ "GET /api/mcp/paperclip": "protocol",
84
+ "GET /api/openapi.json": "actor:public",
85
+ "GET /api/projects/{id}": "curated:paperclipGetProject",
86
+ "GET /api/secret-provider-configs/{id}": "credential_surface",
87
+ "GET /api/secrets/{id}/access-events": "credential_surface",
88
+ "GET /api/secrets/{id}/usage": "credential_surface",
89
+ "GET /api/skills/catalog/{catalogId}/files": "non_json_response",
90
+ "GET /api/teams/catalog/{catalogId}/files": "non_json_response",
91
+ "GET /api/tool-gateway/gateways/{gatewayId}/mcp": "actor:public",
92
+ "GET /api/tools/oauth/callback": "protocol",
93
+ "GET /api/tools/oauth/cloud-connector/callback": "protocol",
94
+ "GET /api/tools/oauth/cloud-connector/enrollment": "protocol",
95
+ "GET /api/tools/oauth/cloud-connector/enrollment-callback": "protocol",
96
+ "GET /api/tools/oauth/paperclip-id/callback": "protocol",
97
+ "GET /mcp/gateways/{gatewayPublicId}": "actor:public",
98
+ "GET /mcp/runtime-tools": "actor:runtime_tools",
99
+ "PATCH /api/auth/profile": "protocol",
100
+ "PATCH /api/companies/{companyId}/me/user-secrets/{secretId}": "credential_surface",
101
+ "PATCH /api/companies/{companyId}/skills/{skillId}/files": "non_json_response",
102
+ "PATCH /api/companies/{companyId}/user-secret-definitions/{definitionId}": "credential_surface",
103
+ "PATCH /api/issues/{id}": "curated:paperclipUpdateIssue",
104
+ "PATCH /api/secret-provider-configs/{id}": "credential_surface",
105
+ "PATCH /api/secrets/{id}": "credential_surface",
106
+ "POST /api/admin/users/{userId}/demote-instance-admin": "instance_admin",
107
+ "POST /api/admin/users/{userId}/promote-instance-admin": "instance_admin",
108
+ "POST /api/agents/{id}/keys": "credential_surface",
109
+ "POST /api/agents/me/connections/{connectionId}/token": "credential_surface",
110
+ "POST /api/agents/me/secret-proposals": "credential_surface",
111
+ "POST /api/agents/me/secrets/{key}/value": "credential_surface",
112
+ "POST /api/approvals/{id}/approve": "curated:paperclipApprovalDecision",
113
+ "POST /api/approvals/{id}/comments": "curated:paperclipAddApprovalComment",
114
+ "POST /api/approvals/{id}/reject": "curated:paperclipApprovalDecision",
115
+ "POST /api/approvals/{id}/request-revision": "curated:paperclipApprovalDecision",
116
+ "POST /api/approvals/{id}/resubmit": "curated:paperclipApprovalDecision",
117
+ "POST /api/board-api-keys": "credential_surface",
118
+ "POST /api/board-claim/{token}/claim": "credential_surface",
119
+ "POST /api/board/chat/stream": "non_json_response",
120
+ "POST /api/cases/{id}/attachments": "non_json_request",
121
+ "POST /api/chat-endpoints/{endpointId}/setup-secret": "credential_surface",
122
+ "POST /api/cli-auth/challenges": "actor:public",
123
+ "POST /api/cli-auth/challenges/{id}/approve": "protocol",
124
+ "POST /api/cli-auth/challenges/{id}/cancel": "actor:public",
125
+ "POST /api/cli-auth/revoke-current": "protocol",
126
+ "POST /api/companies": "instance_admin",
127
+ "POST /api/companies/{companyId}/approvals": "curated:paperclipCreateApproval",
128
+ "POST /api/companies/{companyId}/exports": "reviewed:credential_surface",
129
+ "POST /api/companies/{companyId}/exports/preview": "reviewed:credential_surface",
130
+ "POST /api/companies/{companyId}/imports/apply": "reviewed:company_transfer",
131
+ "POST /api/companies/{companyId}/imports/preview": "reviewed:company_transfer",
132
+ "POST /api/companies/{companyId}/invites": "credential_surface",
133
+ "POST /api/companies/{companyId}/issues": "curated:paperclipCreateIssue",
134
+ "POST /api/companies/{companyId}/join-requests/{requestId}/approve": "credential_surface",
135
+ "POST /api/companies/{companyId}/join-requests/{requestId}/reject": "credential_surface",
136
+ "POST /api/companies/{companyId}/me/user-secrets": "credential_surface",
137
+ "POST /api/companies/{companyId}/me/user-secrets/{secretId}/rotate": "credential_surface",
138
+ "POST /api/companies/{companyId}/onboarding-seed": "reviewed:instance_setup",
139
+ "POST /api/companies/{companyId}/secret-proposals/{id}/approve": "credential_surface",
140
+ "POST /api/companies/{companyId}/secret-proposals/{id}/reject": "credential_surface",
141
+ "POST /api/companies/{companyId}/secret-provider-configs": "credential_surface",
142
+ "POST /api/companies/{companyId}/secret-provider-configs/discovery/preview": "credential_surface",
143
+ "POST /api/companies/{companyId}/secrets": "credential_surface",
144
+ "POST /api/companies/{companyId}/secrets/remote-import": "credential_surface",
145
+ "POST /api/companies/{companyId}/secrets/remote-import/preview": "credential_surface",
146
+ "POST /api/companies/{companyId}/setup-token-login-sessions": "credential_surface",
147
+ "POST /api/companies/{companyId}/setup-token-login-sessions/{sessionId}/cancel": "credential_surface",
148
+ "POST /api/companies/{companyId}/setup-token-login-sessions/{sessionId}/code": "credential_surface",
149
+ "POST /api/companies/{companyId}/setup-token-login-sessions/{sessionId}/completion": "credential_surface",
150
+ "POST /api/companies/{companyId}/slack/tasks/{issueId}/tools": "actor:agent",
151
+ "POST /api/companies/{companyId}/smoke-lab/oauth/authorize": "protocol",
152
+ "POST /api/companies/{companyId}/smoke-lab/oauth/revoke": "protocol",
153
+ "POST /api/companies/{companyId}/smoke-lab/oauth/token": "protocol",
154
+ "POST /api/companies/{companyId}/tools/mcp/import-json": "protocol",
155
+ "POST /api/companies/{companyId}/user-secret-definitions": "credential_surface",
156
+ "POST /api/companies/import/transfers/{transferId}/apply": "reviewed:company_transfer",
157
+ "POST /api/environment-custom-image-setup-sessions/{sessionId}/terminal-session-token": "credential_surface",
158
+ "POST /api/execution-workspaces/{id}/runtime-services/{action}": "curated:paperclipControlIssueWorkspaceServices",
159
+ "POST /api/instance/database-backups": "instance_admin",
160
+ "POST /api/invites/{inviteId}/revoke": "credential_surface",
161
+ "POST /api/invites/{token}/accept": "actor:public",
162
+ "POST /api/issues/{id}/admin/force-release": "reviewed:runner_lifecycle_authority",
163
+ "POST /api/issues/{id}/approvals": "curated:paperclipLinkIssueApproval",
164
+ "POST /api/issues/{id}/checkout": "curated:paperclipCheckoutIssue",
165
+ "POST /api/issues/{id}/comments": "curated:paperclipAddComment",
166
+ "POST /api/issues/{id}/documents/{key}/revisions/{revisionId}/restore": "curated:paperclipRestoreIssueDocumentRevision",
167
+ "POST /api/issues/{id}/interactions": "curated:paperclipSuggestTasks",
168
+ "POST /api/issues/{id}/low-trust/promotions": "reviewed:trust_boundary",
169
+ "POST /api/issues/{id}/release": "curated:paperclipReleaseIssue",
170
+ "POST /api/join-requests/{requestId}/claim-api-key": "actor:public",
171
+ "POST /api/mcp/paperclip": "protocol",
172
+ "POST /api/mcp/project-tools": "actor:agent",
173
+ "POST /api/plugins/install": "instance_admin",
174
+ "POST /api/routine-triggers/{id}/rotate-secret": "credential_surface",
175
+ "POST /api/secret-provider-configs/{id}/default": "credential_surface",
176
+ "POST /api/secret-provider-configs/{id}/health": "credential_surface",
177
+ "POST /api/secrets/{id}/rotate": "credential_surface",
178
+ "POST /api/tool-gateway/gateway-tokens/{tokenId}/revoke": "credential_surface",
179
+ "POST /api/tool-gateway/gateways/{gatewayId}/mcp": "actor:public",
180
+ "POST /api/tool-gateway/gateways/{gatewayId}/tokens": "credential_surface",
181
+ "POST /api/tool-gateway/runtime-slots/{slotId}/restart": "reviewed:runtime_authority",
182
+ "POST /api/tool-gateway/runtime-slots/{slotId}/stop": "reviewed:runtime_authority",
183
+ "POST /api/tool-gateway/sessions": "reviewed:credential_surface",
184
+ "POST /api/tool-gateway/sessions/{sessionId}/revoke": "reviewed:credential_surface",
185
+ "POST /api/tools/oauth/{connectionId}/start": "protocol",
186
+ "POST /api/tools/oauth/cloud-connector/enrollment": "protocol",
187
+ "POST /mcp/gateways/{gatewayPublicId}": "actor:public",
188
+ "POST /mcp/runtime-tools": "actor:runtime_tools",
189
+ "POST /runtime-tools/connections/request": "actor:runtime_tools",
190
+ "POST /runtime-tools/connections/search": "actor:runtime_tools",
191
+ "POST /runtime-tools/github/credentials": "actor:runtime_tools",
192
+ "PUT /api/admin/users/{userId}/company-access": "instance_admin",
193
+ "PUT /api/companies/import/transfers/{transferId}/parts/{partIndex}": "non_json_request",
194
+ "PUT /api/issues/{id}/documents/{key}": "curated:paperclipUpsertIssueDocument"
195
+ }
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ import type { PaperclipApiClient } from "./client.js";
3
+ import type { ToolDefinition } from "./tools.js";
4
+ import type { ToolsetName } from "./tool-overrides.js";
5
+ declare const generatedToolSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ operationId: z.ZodString;
8
+ method: z.ZodString;
9
+ path: z.ZodString;
10
+ description: z.ZodString;
11
+ toolset: z.ZodEnum<{
12
+ core: "core";
13
+ extended: "extended";
14
+ }>;
15
+ authority: z.ZodEnum<{
16
+ agent: "agent";
17
+ board: "board";
18
+ }>;
19
+ authoritySource: z.ZodEnum<{
20
+ default: "default";
21
+ handler: "handler";
22
+ probe: "probe";
23
+ registry: "registry";
24
+ }>;
25
+ guards: z.ZodArray<z.ZodString>;
26
+ permissions: z.ZodArray<z.ZodString>;
27
+ boardGuard: z.ZodNullable<z.ZodString>;
28
+ tags: z.ZodArray<z.ZodString>;
29
+ annotations: z.ZodObject<{
30
+ readOnlyHint: z.ZodBoolean;
31
+ destructiveHint: z.ZodBoolean;
32
+ idempotentHint: z.ZodBoolean;
33
+ }, z.core.$strip>;
34
+ parameters: z.ZodArray<z.ZodObject<{
35
+ name: z.ZodString;
36
+ in: z.ZodEnum<{
37
+ path: "path";
38
+ query: "query";
39
+ }>;
40
+ required: z.ZodBoolean;
41
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
42
+ }, z.core.$strip>>;
43
+ body: z.ZodOptional<z.ZodObject<{
44
+ required: z.ZodBoolean;
45
+ documented: z.ZodBoolean;
46
+ mode: z.ZodEnum<{
47
+ merge: "merge";
48
+ nest: "nest";
49
+ }>;
50
+ advanced: z.ZodOptional<z.ZodBoolean>;
51
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>;
54
+ export type GeneratedToolSpec = z.infer<typeof generatedToolSchema>;
55
+ export declare function generatedToolSpecs(): GeneratedToolSpec[];
56
+ export interface PreparedGeneratedTool {
57
+ spec: GeneratedToolSpec;
58
+ schema: z.ZodObject;
59
+ }
60
+ export declare function prepareGeneratedTools(toolsets: ReadonlyArray<ToolsetName>, management: boolean): PreparedGeneratedTool[];
61
+ export declare function bindGeneratedTools(prepared: ReadonlyArray<PreparedGeneratedTool>, client: PaperclipApiClient): ToolDefinition[];
62
+ export declare function createGeneratedToolDefinitions(client: PaperclipApiClient, toolsets: ReadonlyArray<ToolsetName>, management?: boolean): ToolDefinition[];
63
+ export {};
64
+ //# sourceMappingURL=generated-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-tools.d.ts","sourceRoot":"","sources":["../src/generated-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCvB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAgBpE,wBAAgB,kBAAkB,IAAI,iBAAiB,EAAE,CAGxD;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC;CACrB;AAID,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,EACpC,UAAU,EAAE,OAAO,GAClB,qBAAqB,EAAE,CASzB;AA8DD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,CAAC,qBAAqB,CAAC,EAC9C,MAAM,EAAE,kBAAkB,GACzB,cAAc,EAAE,CAoClB;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,EACpC,UAAU,UAAQ,GACjB,cAAc,EAAE,CAElB"}
@@ -0,0 +1,161 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { z } from "zod";
3
+ import { formatErrorResponse, formatTextResponse } from "./format.js";
4
+ const jsonSchemaValue = z.record(z.string(), z.unknown());
5
+ const generatedToolSchema = z.object({
6
+ name: z.string(),
7
+ operationId: z.string(),
8
+ method: z.string(),
9
+ path: z.string(),
10
+ description: z.string(),
11
+ toolset: z.enum(["core", "extended"]),
12
+ authority: z.enum(["agent", "board"]),
13
+ authoritySource: z.enum(["handler", "registry", "probe", "default"]),
14
+ guards: z.array(z.string()),
15
+ permissions: z.array(z.string()),
16
+ boardGuard: z.string().nullable(),
17
+ tags: z.array(z.string()),
18
+ annotations: z.object({
19
+ readOnlyHint: z.boolean(),
20
+ destructiveHint: z.boolean(),
21
+ idempotentHint: z.boolean(),
22
+ }),
23
+ parameters: z.array(z.object({
24
+ name: z.string(),
25
+ in: z.enum(["path", "query"]),
26
+ required: z.boolean(),
27
+ schema: jsonSchemaValue,
28
+ })),
29
+ body: z
30
+ .object({
31
+ required: z.boolean(),
32
+ documented: z.boolean(),
33
+ mode: z.enum(["merge", "nest"]),
34
+ advanced: z.boolean().optional(),
35
+ schema: jsonSchemaValue,
36
+ })
37
+ .optional(),
38
+ });
39
+ let cachedSpecs;
40
+ const generatedToolListSchema = z.array(generatedToolSchema);
41
+ function readGeneratedToolFile() {
42
+ const parsed = JSON.parse(readFileSync(new URL("./generated/api-tools.json", import.meta.url), "utf8"));
43
+ if (!Array.isArray(parsed)) {
44
+ throw new Error("Generated MCP tool definitions must be an array");
45
+ }
46
+ return parsed;
47
+ }
48
+ export function generatedToolSpecs() {
49
+ cachedSpecs ??= generatedToolListSchema.parse(readGeneratedToolFile());
50
+ return cachedSpecs;
51
+ }
52
+ const preparedVariants = new Map();
53
+ export function prepareGeneratedTools(toolsets, management) {
54
+ const key = `${[...toolsets].sort().join(",")}|${management ? "management" : "agent"}`;
55
+ const cached = preparedVariants.get(key);
56
+ if (cached)
57
+ return cached;
58
+ const prepared = generatedToolSpecs()
59
+ .filter((spec) => toolsets.includes(spec.toolset) && (management || spec.authority === "agent"))
60
+ .map((spec) => ({ spec, schema: inputSchema(spec) }));
61
+ preparedVariants.set(key, prepared);
62
+ return prepared;
63
+ }
64
+ function inputSchema(spec) {
65
+ const properties = {};
66
+ const required = [];
67
+ for (const parameter of spec.parameters) {
68
+ properties[parameter.name] = parameter.schema;
69
+ if (parameter.required && parameter.name !== "companyId")
70
+ required.push(parameter.name);
71
+ }
72
+ if (spec.body?.mode === "merge") {
73
+ Object.assign(properties, (spec.body.schema.properties ?? {}));
74
+ required.push(...(spec.body.schema.required ?? []));
75
+ }
76
+ else if (spec.body) {
77
+ properties.body = spec.body.schema;
78
+ if (spec.body.required)
79
+ required.push("body");
80
+ }
81
+ const schema = {
82
+ type: "object",
83
+ properties,
84
+ ...(required.length > 0 ? { required: [...new Set(required)] } : {}),
85
+ };
86
+ const converted = z.fromJSONSchema(schema, { defaultTarget: "draft-2020-12" });
87
+ if (!(converted instanceof z.ZodObject)) {
88
+ throw new Error(`Generated tool ${spec.name} did not produce an object schema`);
89
+ }
90
+ if (!spec.body?.advanced)
91
+ return converted;
92
+ return converted.extend({
93
+ advanced: z
94
+ .record(z.string(), z.unknown())
95
+ .optional()
96
+ .describe(`any other field accepted by ${spec.method} ${spec.path}; see paperclipApiRequest for the full schema`),
97
+ });
98
+ }
99
+ function requestPath(client, spec, values) {
100
+ let path = spec.path;
101
+ const query = new URLSearchParams();
102
+ for (const parameter of spec.parameters) {
103
+ const supplied = values[parameter.name];
104
+ delete values[parameter.name];
105
+ if (parameter.in === "path") {
106
+ const resolved = parameter.name === "companyId"
107
+ ? client.resolveCompanyId(typeof supplied === "string" ? supplied : null)
108
+ : supplied;
109
+ if (resolved === undefined || resolved === null || resolved === "") {
110
+ throw new Error(`${parameter.name} is required by ${spec.operationId}`);
111
+ }
112
+ path = path.replace(`{${parameter.name}}`, encodeURIComponent(String(resolved)));
113
+ continue;
114
+ }
115
+ if (supplied === undefined || supplied === null)
116
+ continue;
117
+ for (const entry of Array.isArray(supplied) ? supplied : [supplied]) {
118
+ query.append(parameter.name, String(entry));
119
+ }
120
+ }
121
+ const search = query.toString();
122
+ return search.length > 0 ? `${path}?${search}` : path;
123
+ }
124
+ export function bindGeneratedTools(prepared, client) {
125
+ return prepared.map(({ spec, schema }) => ({
126
+ name: spec.name,
127
+ description: spec.description,
128
+ schema,
129
+ annotations: {
130
+ readOnlyHint: spec.annotations.readOnlyHint,
131
+ destructiveHint: spec.annotations.destructiveHint,
132
+ idempotentHint: spec.annotations.idempotentHint,
133
+ },
134
+ execute: async (input) => {
135
+ try {
136
+ const values = { ...schema.parse(input) };
137
+ const advanced = values.advanced;
138
+ delete values.advanced;
139
+ const path = requestPath(client, spec, values);
140
+ const requestBody = spec.body?.mode === "nest"
141
+ ? values.body
142
+ : spec.body
143
+ ? values
144
+ : spec.method === "GET"
145
+ ? undefined
146
+ : {};
147
+ const body = advanced && requestBody !== undefined && requestBody !== null
148
+ ? { ...requestBody, ...advanced }
149
+ : requestBody;
150
+ return formatTextResponse(await client.requestJson(spec.method, path, body === undefined ? {} : { body }));
151
+ }
152
+ catch (error) {
153
+ return formatErrorResponse(error);
154
+ }
155
+ },
156
+ }));
157
+ }
158
+ export function createGeneratedToolDefinitions(client, toolsets, management = false) {
159
+ return bindGeneratedTools(prepareGeneratedTools(toolsets, management), client);
160
+ }
161
+ //# sourceMappingURL=generated-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-tools.js","sourceRoot":"","sources":["../src/generated-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItE,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAE1D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,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I,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAChF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,MAA0B,EAC1B,QAAoC,EACpC,UAAU,GAAG,KAAK;IAElB,OAAO,kBAAkB,CAAC,qBAAqB,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generated-tools.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-tools.test.d.ts","sourceRoot":"","sources":["../src/generated-tools.test.ts"],"names":[],"mappings":""}