@ctxprotocol/sdk 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/client/index.cjs +70 -0
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +39 -3
- package/dist/client/index.d.ts +39 -3
- package/dist/client/index.js +69 -1
- package/dist/client/index.js.map +1 -1
- package/dist/contrib/search/index.d.cts +2 -2
- package/dist/contrib/search/index.d.ts +2 -2
- package/dist/index.cjs +69 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +69 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-Bgjq3OBR.d.cts → types-DRbq-FA6.d.cts} +110 -1
- package/dist/{types-Bgjq3OBR.d.ts → types-DRbq-FA6.d.ts} +110 -1
- package/package.json +1 -1
package/dist/client/index.d.cts
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
|
-
import { T as Tool, H as SearchOptions, I as ExecuteOptions, O as ExecutionResult, J as ExecuteSessionStartOptions, N as ExecuteSessionResult, a0 as QueryOptions, a1 as QueryResult, ad as QueryStreamEvent, D as ContextClientOptions } from '../types-
|
|
2
|
-
export { B as ContextError,
|
|
1
|
+
import { aj as UpdateToolOptions, ak as UpdateToolResult, T as Tool, H as SearchOptions, I as ExecuteOptions, O as ExecutionResult, J as ExecuteSessionStartOptions, N as ExecuteSessionResult, a0 as QueryOptions, a1 as QueryResult, ad as QueryStreamEvent, D as ContextClientOptions } from '../types-DRbq-FA6.cjs';
|
|
2
|
+
export { at as ALLOWED_TOOL_CATEGORIES, B as ContextError, al as ContextErrorCode, U as ExecuteApiErrorResponse, V as ExecuteApiResponse, P as ExecuteApiSuccessResponse, X as ExecuteSessionApiResponse, W as ExecuteSessionApiSuccessResponse, L as ExecuteSessionSpend, K as ExecuteSessionStatus, M as McpTool, E as McpToolMeta, F as McpToolRateLimitHints, ac as QueryApiResponse, ab as QueryApiSuccessResponse, aq as QueryAssumptionMetadata, Z as QueryAttemptForkReason, _ as QueryAttemptReference, ap as QueryCapabilityMissPayload, an as QueryClarificationOption, am as QueryClarificationPayload, ao as QueryClarificationPolicy, a5 as QueryCompletenessRepairEvent, a4 as QueryCost, Y as QueryDeepMode, Q as QueryDeveloperTrace, a6 as QueryDeveloperTraceDiagnostics, aa as QueryDeveloperTraceLoopInfo, a8 as QueryDeveloperTraceStep, a7 as QueryDeveloperTraceSummary, a9 as QueryDeveloperTraceToolRef, $ as QueryForkReference, ar as QueryOutcomeType, a2 as QuerySessionState, ag as QueryStreamDeveloperTraceEvent, ah as QueryStreamDoneEvent, ai as QueryStreamErrorEvent, af as QueryStreamTextDeltaEvent, ae as QueryStreamToolStatusEvent, a3 as QueryToolUsage, G as SearchResponse, as as ToolCategory } from '../types-DRbq-FA6.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Developer resource for managing tool listings on the Context Protocol marketplace.
|
|
6
|
+
*
|
|
7
|
+
* Scoped to contributor/developer concerns (listing management), separate from
|
|
8
|
+
* the consumer-facing `tools.execute()` and `query.run()`.
|
|
9
|
+
*/
|
|
10
|
+
declare class Developer {
|
|
11
|
+
private client;
|
|
12
|
+
constructor(client: ContextClient);
|
|
13
|
+
/**
|
|
14
|
+
* Update a tool listing's metadata (name, description, category).
|
|
15
|
+
*
|
|
16
|
+
* Requires an API key belonging to the tool's owner.
|
|
17
|
+
*
|
|
18
|
+
* @param toolId - The UUID of the tool to update
|
|
19
|
+
* @param updates - Fields to update (at least one required)
|
|
20
|
+
* @returns The updated tool metadata
|
|
21
|
+
*
|
|
22
|
+
* @throws {ContextError} If authentication fails or the caller does not own the tool
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const updated = await client.developer.updateTool("tool-uuid", {
|
|
27
|
+
* description: "Updated description with better showcase prompts",
|
|
28
|
+
* category: "crypto",
|
|
29
|
+
* });
|
|
30
|
+
* console.log(updated.updatedAt);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
updateTool(toolId: string, updates: UpdateToolOptions): Promise<UpdateToolResult>;
|
|
34
|
+
}
|
|
3
35
|
|
|
4
36
|
/**
|
|
5
37
|
* Discovery resource for searching and finding tools on the Context Protocol marketplace
|
|
@@ -211,6 +243,10 @@ declare class ContextClient {
|
|
|
211
243
|
private readonly requestTimeoutMs;
|
|
212
244
|
private readonly streamTimeoutMs;
|
|
213
245
|
private _closed;
|
|
246
|
+
/**
|
|
247
|
+
* Developer resource for managing tool listings (contributor/developer concerns).
|
|
248
|
+
*/
|
|
249
|
+
readonly developer: Developer;
|
|
214
250
|
/**
|
|
215
251
|
* Discovery resource for searching tools
|
|
216
252
|
*/
|
|
@@ -261,4 +297,4 @@ declare class ContextClient {
|
|
|
261
297
|
_fetchRaw(endpoint: string, options?: RequestInit): Promise<Response>;
|
|
262
298
|
}
|
|
263
299
|
|
|
264
|
-
export { ContextClient, ContextClientOptions, Discovery, ExecuteOptions, ExecuteSessionResult, ExecuteSessionStartOptions, ExecutionResult, Query, QueryOptions, QueryResult, QueryStreamEvent, SearchOptions, Tool, Tools };
|
|
300
|
+
export { ContextClient, ContextClientOptions, Developer, Discovery, ExecuteOptions, ExecuteSessionResult, ExecuteSessionStartOptions, ExecutionResult, Query, QueryOptions, QueryResult, QueryStreamEvent, SearchOptions, Tool, Tools, UpdateToolOptions, UpdateToolResult };
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
|
-
import { T as Tool, H as SearchOptions, I as ExecuteOptions, O as ExecutionResult, J as ExecuteSessionStartOptions, N as ExecuteSessionResult, a0 as QueryOptions, a1 as QueryResult, ad as QueryStreamEvent, D as ContextClientOptions } from '../types-
|
|
2
|
-
export { B as ContextError,
|
|
1
|
+
import { aj as UpdateToolOptions, ak as UpdateToolResult, T as Tool, H as SearchOptions, I as ExecuteOptions, O as ExecutionResult, J as ExecuteSessionStartOptions, N as ExecuteSessionResult, a0 as QueryOptions, a1 as QueryResult, ad as QueryStreamEvent, D as ContextClientOptions } from '../types-DRbq-FA6.js';
|
|
2
|
+
export { at as ALLOWED_TOOL_CATEGORIES, B as ContextError, al as ContextErrorCode, U as ExecuteApiErrorResponse, V as ExecuteApiResponse, P as ExecuteApiSuccessResponse, X as ExecuteSessionApiResponse, W as ExecuteSessionApiSuccessResponse, L as ExecuteSessionSpend, K as ExecuteSessionStatus, M as McpTool, E as McpToolMeta, F as McpToolRateLimitHints, ac as QueryApiResponse, ab as QueryApiSuccessResponse, aq as QueryAssumptionMetadata, Z as QueryAttemptForkReason, _ as QueryAttemptReference, ap as QueryCapabilityMissPayload, an as QueryClarificationOption, am as QueryClarificationPayload, ao as QueryClarificationPolicy, a5 as QueryCompletenessRepairEvent, a4 as QueryCost, Y as QueryDeepMode, Q as QueryDeveloperTrace, a6 as QueryDeveloperTraceDiagnostics, aa as QueryDeveloperTraceLoopInfo, a8 as QueryDeveloperTraceStep, a7 as QueryDeveloperTraceSummary, a9 as QueryDeveloperTraceToolRef, $ as QueryForkReference, ar as QueryOutcomeType, a2 as QuerySessionState, ag as QueryStreamDeveloperTraceEvent, ah as QueryStreamDoneEvent, ai as QueryStreamErrorEvent, af as QueryStreamTextDeltaEvent, ae as QueryStreamToolStatusEvent, a3 as QueryToolUsage, G as SearchResponse, as as ToolCategory } from '../types-DRbq-FA6.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Developer resource for managing tool listings on the Context Protocol marketplace.
|
|
6
|
+
*
|
|
7
|
+
* Scoped to contributor/developer concerns (listing management), separate from
|
|
8
|
+
* the consumer-facing `tools.execute()` and `query.run()`.
|
|
9
|
+
*/
|
|
10
|
+
declare class Developer {
|
|
11
|
+
private client;
|
|
12
|
+
constructor(client: ContextClient);
|
|
13
|
+
/**
|
|
14
|
+
* Update a tool listing's metadata (name, description, category).
|
|
15
|
+
*
|
|
16
|
+
* Requires an API key belonging to the tool's owner.
|
|
17
|
+
*
|
|
18
|
+
* @param toolId - The UUID of the tool to update
|
|
19
|
+
* @param updates - Fields to update (at least one required)
|
|
20
|
+
* @returns The updated tool metadata
|
|
21
|
+
*
|
|
22
|
+
* @throws {ContextError} If authentication fails or the caller does not own the tool
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const updated = await client.developer.updateTool("tool-uuid", {
|
|
27
|
+
* description: "Updated description with better showcase prompts",
|
|
28
|
+
* category: "crypto",
|
|
29
|
+
* });
|
|
30
|
+
* console.log(updated.updatedAt);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
updateTool(toolId: string, updates: UpdateToolOptions): Promise<UpdateToolResult>;
|
|
34
|
+
}
|
|
3
35
|
|
|
4
36
|
/**
|
|
5
37
|
* Discovery resource for searching and finding tools on the Context Protocol marketplace
|
|
@@ -211,6 +243,10 @@ declare class ContextClient {
|
|
|
211
243
|
private readonly requestTimeoutMs;
|
|
212
244
|
private readonly streamTimeoutMs;
|
|
213
245
|
private _closed;
|
|
246
|
+
/**
|
|
247
|
+
* Developer resource for managing tool listings (contributor/developer concerns).
|
|
248
|
+
*/
|
|
249
|
+
readonly developer: Developer;
|
|
214
250
|
/**
|
|
215
251
|
* Discovery resource for searching tools
|
|
216
252
|
*/
|
|
@@ -261,4 +297,4 @@ declare class ContextClient {
|
|
|
261
297
|
_fetchRaw(endpoint: string, options?: RequestInit): Promise<Response>;
|
|
262
298
|
}
|
|
263
299
|
|
|
264
|
-
export { ContextClient, ContextClientOptions, Discovery, ExecuteOptions, ExecuteSessionResult, ExecuteSessionStartOptions, ExecutionResult, Query, QueryOptions, QueryResult, QueryStreamEvent, SearchOptions, Tool, Tools };
|
|
300
|
+
export { ContextClient, ContextClientOptions, Developer, Discovery, ExecuteOptions, ExecuteSessionResult, ExecuteSessionStartOptions, ExecutionResult, Query, QueryOptions, QueryResult, QueryStreamEvent, SearchOptions, Tool, Tools, UpdateToolOptions, UpdateToolResult };
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
// src/client/types.ts
|
|
2
|
+
var ALLOWED_TOOL_CATEGORIES = [
|
|
3
|
+
"Crypto & DeFi",
|
|
4
|
+
"Financial Markets",
|
|
5
|
+
"Business & Sales",
|
|
6
|
+
"Marketing & SEO",
|
|
7
|
+
"Legal & Regulatory",
|
|
8
|
+
"Real World",
|
|
9
|
+
"Developer Tools",
|
|
10
|
+
"Research & Academia",
|
|
11
|
+
"Utility",
|
|
12
|
+
"Other"
|
|
13
|
+
];
|
|
2
14
|
var ContextError = class _ContextError extends Error {
|
|
3
15
|
constructor(message, code, statusCode, helpUrl) {
|
|
4
16
|
super(message);
|
|
@@ -10,6 +22,57 @@ var ContextError = class _ContextError extends Error {
|
|
|
10
22
|
}
|
|
11
23
|
};
|
|
12
24
|
|
|
25
|
+
// src/client/resources/developer.ts
|
|
26
|
+
var Developer = class {
|
|
27
|
+
constructor(client) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Update a tool listing's metadata (name, description, category).
|
|
32
|
+
*
|
|
33
|
+
* Requires an API key belonging to the tool's owner.
|
|
34
|
+
*
|
|
35
|
+
* @param toolId - The UUID of the tool to update
|
|
36
|
+
* @param updates - Fields to update (at least one required)
|
|
37
|
+
* @returns The updated tool metadata
|
|
38
|
+
*
|
|
39
|
+
* @throws {ContextError} If authentication fails or the caller does not own the tool
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const updated = await client.developer.updateTool("tool-uuid", {
|
|
44
|
+
* description: "Updated description with better showcase prompts",
|
|
45
|
+
* category: "crypto",
|
|
46
|
+
* });
|
|
47
|
+
* console.log(updated.updatedAt);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
async updateTool(toolId, updates) {
|
|
51
|
+
if (!toolId) {
|
|
52
|
+
throw new ContextError("toolId is required");
|
|
53
|
+
}
|
|
54
|
+
if (updates.name === void 0 && updates.description === void 0 && updates.category === void 0) {
|
|
55
|
+
throw new ContextError(
|
|
56
|
+
"At least one field required: name, description, or category"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (updates.category !== void 0 && updates.category !== null && !ALLOWED_TOOL_CATEGORIES.includes(updates.category)) {
|
|
60
|
+
throw new ContextError(
|
|
61
|
+
`category must be one of: ${ALLOWED_TOOL_CATEGORIES.join(", ")}`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
const encodedToolId = encodeURIComponent(toolId);
|
|
65
|
+
return this.client._fetch(
|
|
66
|
+
`/api/v1/tools/${encodedToolId}`,
|
|
67
|
+
{
|
|
68
|
+
method: "PATCH",
|
|
69
|
+
body: JSON.stringify(updates)
|
|
70
|
+
},
|
|
71
|
+
{ retry: false }
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
13
76
|
// src/client/resources/discovery.ts
|
|
14
77
|
var Discovery = class {
|
|
15
78
|
constructor(client) {
|
|
@@ -607,6 +670,10 @@ var ContextClient = class {
|
|
|
607
670
|
requestTimeoutMs;
|
|
608
671
|
streamTimeoutMs;
|
|
609
672
|
_closed = false;
|
|
673
|
+
/**
|
|
674
|
+
* Developer resource for managing tool listings (contributor/developer concerns).
|
|
675
|
+
*/
|
|
676
|
+
developer;
|
|
610
677
|
/**
|
|
611
678
|
* Discovery resource for searching tools
|
|
612
679
|
*/
|
|
@@ -648,6 +715,7 @@ var ContextClient = class {
|
|
|
648
715
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
649
716
|
this.requestTimeoutMs = requestTimeoutMs;
|
|
650
717
|
this.streamTimeoutMs = streamTimeoutMs;
|
|
718
|
+
this.developer = new Developer(this);
|
|
651
719
|
this.discovery = new Discovery(this);
|
|
652
720
|
this.tools = new Tools(this);
|
|
653
721
|
this.query = new Query(this);
|
|
@@ -806,6 +874,6 @@ var ContextClient = class {
|
|
|
806
874
|
}
|
|
807
875
|
};
|
|
808
876
|
|
|
809
|
-
export { ContextClient, ContextError, Discovery, Query, Tools };
|
|
877
|
+
export { ALLOWED_TOOL_CATEGORIES, ContextClient, ContextError, Developer, Discovery, Query, Tools };
|
|
810
878
|
//# sourceMappingURL=index.js.map
|
|
811
879
|
//# sourceMappingURL=index.js.map
|