@dalmia/calibrate-mcp 0.0.34 → 0.0.35

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 (63) hide show
  1. package/bin/mcp-server.js +235 -9
  2. package/bin/mcp-server.js.map +17 -8
  3. package/esm/funcs/tracesCreate.d.ts +16 -0
  4. package/esm/funcs/tracesCreate.d.ts.map +1 -0
  5. package/esm/funcs/tracesCreate.js +86 -0
  6. package/esm/funcs/tracesCreate.js.map +1 -0
  7. package/esm/landing-page.js +1 -1
  8. package/esm/lib/config.d.ts +2 -2
  9. package/esm/lib/config.js +2 -2
  10. package/esm/mcp-server/mcp-server.js +1 -1
  11. package/esm/mcp-server/server.d.ts.map +1 -1
  12. package/esm/mcp-server/server.js +3 -1
  13. package/esm/mcp-server/server.js.map +1 -1
  14. package/esm/mcp-server/tools/tracesCreate.d.ts +7 -0
  15. package/esm/mcp-server/tools/tracesCreate.d.ts.map +1 -0
  16. package/esm/mcp-server/tools/tracesCreate.js +38 -0
  17. package/esm/mcp-server/tools/tracesCreate.js.map +1 -0
  18. package/esm/models/ingesttracetracespostop.d.ts +12 -0
  19. package/esm/models/ingesttracetracespostop.d.ts.map +1 -0
  20. package/esm/models/ingesttracetracespostop.js +16 -0
  21. package/esm/models/ingesttracetracespostop.js.map +1 -0
  22. package/esm/models/traceingest.d.ts +14 -0
  23. package/esm/models/traceingest.d.ts.map +1 -0
  24. package/esm/models/traceingest.js +17 -0
  25. package/esm/models/traceingest.js.map +1 -0
  26. package/esm/models/traceingestresponse.d.ts +9 -0
  27. package/esm/models/traceingestresponse.d.ts.map +1 -0
  28. package/esm/models/traceingestresponse.js +12 -0
  29. package/esm/models/traceingestresponse.js.map +1 -0
  30. package/esm/models/tracemetadataentry.d.ts +7 -0
  31. package/esm/models/tracemetadataentry.d.ts.map +1 -0
  32. package/esm/models/tracemetadataentry.js +10 -0
  33. package/esm/models/tracemetadataentry.js.map +1 -0
  34. package/esm/models/traceoutput.d.ts +8 -0
  35. package/esm/models/traceoutput.d.ts.map +1 -0
  36. package/esm/models/traceoutput.js +10 -0
  37. package/esm/models/traceoutput.js.map +1 -0
  38. package/esm/models/tracetoolcall.d.ts +9 -0
  39. package/esm/models/tracetoolcall.d.ts.map +1 -0
  40. package/esm/models/tracetoolcall.js +9 -0
  41. package/esm/models/tracetoolcall.js.map +1 -0
  42. package/esm/models/traceturn.d.ts +11 -0
  43. package/esm/models/traceturn.d.ts.map +1 -0
  44. package/esm/models/traceturn.js +21 -0
  45. package/esm/models/traceturn.js.map +1 -0
  46. package/esm/tool-names.d.ts.map +1 -1
  47. package/esm/tool-names.js +4 -0
  48. package/esm/tool-names.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/funcs/tracesCreate.ts +148 -0
  51. package/src/landing-page.ts +1 -1
  52. package/src/lib/config.ts +2 -2
  53. package/src/mcp-server/mcp-server.ts +1 -1
  54. package/src/mcp-server/server.ts +3 -1
  55. package/src/mcp-server/tools/tracesCreate.ts +47 -0
  56. package/src/models/ingesttracetracespostop.ts +37 -0
  57. package/src/models/traceingest.ts +40 -0
  58. package/src/models/traceingestresponse.ts +26 -0
  59. package/src/models/tracemetadataentry.ts +13 -0
  60. package/src/models/traceoutput.ts +20 -0
  61. package/src/models/tracetoolcall.ts +17 -0
  62. package/src/models/traceturn.ts +37 -0
  63. package/src/tool-names.ts +4 -0
@@ -0,0 +1,148 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CalibrateMcpCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { safeParse } from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import { APIError } from "../models/errors/apierror.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
21
+ import {
22
+ IngestTraceTracesPostRequest,
23
+ IngestTraceTracesPostRequest$zodSchema,
24
+ } from "../models/ingesttracetracespostop.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Create trace
30
+ *
31
+ * @remarks
32
+ * Store a production agent turn and its conversation history for later review
33
+ */
34
+ export function tracesCreate(
35
+ client$: CalibrateMcpCore,
36
+ request: IngestTraceTracesPostRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ Response,
41
+ | APIError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client$,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client$: CalibrateMcpCore,
59
+ request: IngestTraceTracesPostRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ Response,
65
+ | APIError
66
+ | SDKValidationError
67
+ | UnexpectedClientError
68
+ | InvalidRequestError
69
+ | RequestAbortedError
70
+ | RequestTimeoutError
71
+ | ConnectionError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed$ = safeParse(
77
+ request,
78
+ (value$) => IngestTraceTracesPostRequest$zodSchema.parse(value$),
79
+ "Input validation failed",
80
+ );
81
+ if (!parsed$.ok) {
82
+ return [parsed$, { status: "invalid" }];
83
+ }
84
+ const payload$ = parsed$.value;
85
+ const body$ = encodeJSON("body", payload$.body, { explode: true });
86
+ const path$ = pathToFunc("/traces")();
87
+
88
+ const headers$ = new Headers(compactMap({
89
+ "Content-Type": "application/json",
90
+ Accept: "application/json",
91
+ "X-API-Key": encodeSimple("X-API-Key", payload$.xAPIKey, {
92
+ explode: false,
93
+ charEncoding: "none",
94
+ }),
95
+ }));
96
+ const securityInput = await extractSecurity(client$._options.security);
97
+ const requestSecurity = resolveGlobalSecurity(securityInput);
98
+
99
+ const context = {
100
+ options: client$._options,
101
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
102
+ operationID: "ingest_trace_traces_post",
103
+ oAuth2Scopes: null,
104
+ resolvedSecurity: requestSecurity,
105
+ securitySource: client$._options.security,
106
+ retryConfig: options?.retries
107
+ || client$._options.retryConfig
108
+ || { strategy: "none" },
109
+ retryCodes: options?.retryCodes || [
110
+ "429",
111
+ "500",
112
+ "502",
113
+ "503",
114
+ "504",
115
+ ],
116
+ };
117
+
118
+ const requestRes = client$._createRequest(context, {
119
+ security: requestSecurity,
120
+ method: "POST",
121
+ baseURL: options?.serverURL,
122
+ path: path$,
123
+ headers: headers$,
124
+ body: body$,
125
+ userAgent: client$._options.userAgent,
126
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
127
+ || -1,
128
+ }, options);
129
+ if (!requestRes.ok) {
130
+ return [requestRes, { status: "invalid" }];
131
+ }
132
+ const req$ = requestRes.value;
133
+
134
+ const doResult = await client$._do(req$, {
135
+ context,
136
+ errorCodes: [],
137
+ retryConfig: context.retryConfig,
138
+ retryCodes: context.retryCodes,
139
+ });
140
+ if (!doResult.ok) {
141
+ return [doResult, { status: "request-error", request: req$ }];
142
+ }
143
+ return [doResult, {
144
+ status: "complete",
145
+ "request": req$,
146
+ response: doResult.value,
147
+ }];
148
+ }
@@ -930,7 +930,7 @@ http_headers = { "api-key-auth" = "YOUR_API_KEY_AUTH" }`;
930
930
  <h1>Instructions</h1>
931
931
  <p>One-click installation for Claude Desktop users</p>
932
932
  <div class="instruction-item">
933
- <a href="https://github.com/dalmia/calibrate-mcp/releases/download/v0.0.34/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
933
+ <a href="https://github.com/dalmia/calibrate-mcp/releases/download/v0.0.35/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
934
934
  📥 Download MCP Bundle
935
935
  </a>
936
936
  </div>
package/src/lib/config.ts CHANGED
@@ -65,8 +65,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "0.1.0",
68
- sdkVersion: "0.0.34",
68
+ sdkVersion: "0.0.35",
69
69
  genVersion: "2.915.1",
70
70
  userAgent:
71
- "speakeasy-sdk/mcp-typescript 0.0.34 2.915.1 0.1.0 @dalmia/calibrate-mcp",
71
+ "speakeasy-sdk/mcp-typescript 0.0.35 2.915.1 0.1.0 @dalmia/calibrate-mcp",
72
72
  } as const;
@@ -21,7 +21,7 @@ const routes = buildRouteMap({
21
21
  export const app = buildApplication(routes, {
22
22
  name: "mcp",
23
23
  versionInfo: {
24
- currentVersion: "0.0.34",
24
+ currentVersion: "0.0.35",
25
25
  },
26
26
  });
27
27
 
@@ -55,6 +55,7 @@ import { tool$testsCreate } from "./tools/testsCreate.js";
55
55
  import { tool$testsGet } from "./tools/testsGet.js";
56
56
  import { tool$testsList } from "./tools/testsList.js";
57
57
  import { tool$testsUpdate } from "./tools/testsUpdate.js";
58
+ import { tool$tracesCreate } from "./tools/tracesCreate.js";
58
59
 
59
60
  export function createMCPServer(deps: {
60
61
  logger: ConsoleLogger;
@@ -69,7 +70,7 @@ export function createMCPServer(deps: {
69
70
  }) {
70
71
  const server = new McpServer({
71
72
  name: "CalibrateMcp",
72
- version: "0.0.34",
73
+ version: "0.0.35",
73
74
  });
74
75
 
75
76
  const getClient = deps.getSDK || (() =>
@@ -152,6 +153,7 @@ export function createMCPServer(deps: {
152
153
  tool(tool$annotatorsCreate);
153
154
  tool(tool$annotatorsList);
154
155
  tool(tool$annotatorsUpdate);
156
+ tool(tool$tracesCreate);
155
157
 
156
158
  if (deps.dynamic) {
157
159
  registerDynamicTools(deps.logger, server, getClient, toolMap, scopes);
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { tracesCreate } from "../../funcs/tracesCreate.js";
6
+ import { IngestTraceTracesPostRequest$zodSchema } from "../../models/ingesttracetracespostop.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: IngestTraceTracesPostRequest$zodSchema,
11
+ };
12
+
13
+ export const tool$tracesCreate: ToolDefinition<typeof args> = {
14
+ name: "create-trace",
15
+ description:
16
+ `Store one production agent turn against an agent in the caller's org:
17
+ the conversation history as input, what the agent produced as output,
18
+ and optional metadata. Use this to capture live traffic for later
19
+ review and conversion into tests. Fails with 429 once the workspace
20
+ hits its trace limit.
21
+ `,
22
+ scopes: ["write"],
23
+ annotations: {
24
+ "title": "Create trace",
25
+ "destructiveHint": false,
26
+ "idempotentHint": false,
27
+ "openWorldHint": true,
28
+ "readOnlyHint": false,
29
+ },
30
+ args,
31
+ tool: async (client, args, ctx) => {
32
+ const [result] = await tracesCreate(
33
+ client,
34
+ args.request,
35
+ { fetchOptions: { signal: ctx.signal } },
36
+ ).$inspect();
37
+
38
+ if (!result.ok) {
39
+ return {
40
+ content: [{ type: "text", text: result.error.message }],
41
+ isError: true,
42
+ };
43
+ }
44
+
45
+ return formatResult(result.value);
46
+ },
47
+ };
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import {
7
+ HTTPValidationError,
8
+ HTTPValidationError$zodSchema,
9
+ } from "./httpvalidationerror.js";
10
+ import { TraceIngest, TraceIngest$zodSchema } from "./traceingest.js";
11
+ import {
12
+ TraceIngestResponse,
13
+ TraceIngestResponse$zodSchema,
14
+ } from "./traceingestresponse.js";
15
+
16
+ export type IngestTraceTracesPostRequest = {
17
+ xAPIKey?: string | null | undefined;
18
+ body: TraceIngest;
19
+ };
20
+
21
+ export const IngestTraceTracesPostRequest$zodSchema: z.ZodType<
22
+ IngestTraceTracesPostRequest
23
+ > = z.object({
24
+ body: TraceIngest$zodSchema,
25
+ xAPIKey: z.string().nullable().optional(),
26
+ });
27
+
28
+ export type IngestTraceTracesPostResponse =
29
+ | TraceIngestResponse
30
+ | HTTPValidationError;
31
+
32
+ export const IngestTraceTracesPostResponse$zodSchema: z.ZodType<
33
+ IngestTraceTracesPostResponse
34
+ > = z.union([
35
+ TraceIngestResponse$zodSchema,
36
+ HTTPValidationError$zodSchema,
37
+ ]);
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import {
7
+ TraceMetadataEntry,
8
+ TraceMetadataEntry$zodSchema,
9
+ } from "./tracemetadataentry.js";
10
+ import { TraceOutput, TraceOutput$zodSchema } from "./traceoutput.js";
11
+ import { TraceTurn, TraceTurn$zodSchema } from "./traceturn.js";
12
+
13
+ export type TraceIngest = {
14
+ agent_id: string;
15
+ message_id?: string | null | undefined;
16
+ conversation_id?: string | null | undefined;
17
+ input: Array<TraceTurn>;
18
+ output: TraceOutput;
19
+ metadata?: Array<TraceMetadataEntry> | null | undefined;
20
+ };
21
+
22
+ export const TraceIngest$zodSchema: z.ZodType<TraceIngest> = z.object({
23
+ agent_id: z.string().describe(
24
+ "ID of the agent that produced the turn. Must be an agent in your workspace",
25
+ ),
26
+ conversation_id: z.string().nullable().optional().describe(
27
+ "Your own ID for the conversation this turn belongs to, stored for reference only. Omit if you have none",
28
+ ),
29
+ input: z.array(TraceTurn$zodSchema).describe(
30
+ "Conversation history up to the reported output, oldest turn first, in OpenAI chat format",
31
+ ),
32
+ message_id: z.string().nullable().optional().describe(
33
+ "Your own ID for the last user message in `input`, stored for reference only. Omit if you have none",
34
+ ),
35
+ metadata: z.array(TraceMetadataEntry$zodSchema).nullable().optional()
36
+ .describe(
37
+ "Key-value pairs stored with the trace. Prefer OTel `gen_ai.*` key names where they fit. Omit if you have none",
38
+ ),
39
+ output: TraceOutput$zodSchema,
40
+ });
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+
7
+ export type TraceIngestResponse = {
8
+ uuid: string;
9
+ message_id?: string | null | undefined;
10
+ conversation_id?: string | null | undefined;
11
+ created_at: string;
12
+ };
13
+
14
+ export const TraceIngestResponse$zodSchema: z.ZodType<TraceIngestResponse> = z
15
+ .object({
16
+ conversation_id: z.string().nullable().optional().describe(
17
+ "The conversation ID you sent, if any",
18
+ ),
19
+ created_at: z.string().describe(
20
+ "When the trace was created (ISO 8601 UTC)",
21
+ ),
22
+ message_id: z.string().nullable().optional().describe(
23
+ "The message ID you sent, if any",
24
+ ),
25
+ uuid: z.string().describe("Unique ID for the trace"),
26
+ });
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+
7
+ export type TraceMetadataEntry = { key: string; value: string };
8
+
9
+ export const TraceMetadataEntry$zodSchema: z.ZodType<TraceMetadataEntry> = z
10
+ .object({
11
+ key: z.string().describe("Name of the metadata entry"),
12
+ value: z.string().describe("Value of the metadata entry"),
13
+ });
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { TraceToolCall, TraceToolCall$zodSchema } from "./tracetoolcall.js";
7
+
8
+ export type TraceOutput = {
9
+ response?: string | null | undefined;
10
+ tool_calls?: Array<TraceToolCall> | null | undefined;
11
+ };
12
+
13
+ export const TraceOutput$zodSchema: z.ZodType<TraceOutput> = z.object({
14
+ response: z.string().nullable().optional().describe(
15
+ "The assistant reply text for this turn. Omit for turns that only issued tool calls",
16
+ ),
17
+ tool_calls: z.array(TraceToolCall$zodSchema).nullable().optional().describe(
18
+ "Tool calls the agent issued for this turn. Omit for plain text replies",
19
+ ),
20
+ });
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+
7
+ export type TraceToolCall = {
8
+ tool: string;
9
+ arguments?: { [k: string]: any } | null | undefined;
10
+ };
11
+
12
+ export const TraceToolCall$zodSchema: z.ZodType<TraceToolCall> = z.object({
13
+ arguments: z.record(z.string(), z.any()).nullable().optional().describe(
14
+ "Argument values the agent passed to the tool. Omit when the call had none",
15
+ ),
16
+ tool: z.string().describe("Name of the tool the agent called"),
17
+ });
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { collectExtraKeys as collectExtraKeys$ } from "../lib/schemas.js";
7
+
8
+ export type TraceTurn = {
9
+ role: string;
10
+ content?: string | null | undefined;
11
+ AdditionalProperties?: { [k: string]: any };
12
+ };
13
+
14
+ export const TraceTurn$zodSchema: z.ZodType<TraceTurn> = collectExtraKeys$(
15
+ z.object({
16
+ content: z.string().nullable().optional().describe(
17
+ "Message text. Omit for turns that only carry tool calls",
18
+ ),
19
+ role: z.string().describe(
20
+ "Message author role in the conversation history",
21
+ ),
22
+ }).catchall(z.any()),
23
+ "AdditionalProperties",
24
+ true,
25
+ );
26
+
27
+ export const TraceTurn$zodSchemaOutbound: z.ZodType<any> = z.object({
28
+ AdditionalProperties: z.record(z.string(), z.any()).optional(),
29
+ content: z.nullable(z.string()).optional(),
30
+ role: z.string(),
31
+ }).transform((v) => {
32
+ const { AdditionalProperties, ...rest } = v;
33
+ return {
34
+ ...rest,
35
+ ...AdditionalProperties,
36
+ };
37
+ });
package/src/tool-names.ts CHANGED
@@ -151,5 +151,9 @@ export const toolNames: Array<{ name: string; description: string }>= [
151
151
  {
152
152
  "name": "update-annotator",
153
153
  "description": "Rename an annotator in your workspace.\n"
154
+ },
155
+ {
156
+ "name": "create-trace",
157
+ "description": "Store one production agent turn against an agent in the caller's org:\nthe conversation history as input, what the agent produced as output,\nand optional metadata. Use this to capture live traffic for later\nreview and conversion into tests. Fails with 429 once the workspace\nhits its trace limit.\n"
154
158
  }
155
159
  ];