Skip to content

Commit ec7f479

Browse files
refactor(api): change completed shape
1 parent 71cc60e commit ec7f479

File tree

8 files changed

+76
-36
lines changed

8 files changed

+76
-36
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 20
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-36086d31791dca6112f0c79f44f296d0cdea35df74f4b3b725f86296a51a86fd.yml
3-
openapi_spec_hash: 0ac69304e57ec27533774ed339a44314
4-
config_hash: 8563083ae1fa5c137476fb1237aa8ea9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-babb926f3cc81e4b1d5f10f5cb0f36fc2fd5da122c32a9c2d373d83cb8977848.yml
3+
openapi_spec_hash: e8cb8b819592f7703532f3a7ef1585ef
4+
config_hash: f1b8a43873719fc8f2789008f3aa2260

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Types:
44

55
- <code><a href="./src/resources/shared.ts">Commit</a></code>
6+
- <code><a href="./src/resources/shared.ts">CommitConclusion</a></code>
67
- <code><a href="./src/resources/shared.ts">FileInput</a></code>
78
- <code><a href="./src/resources/shared.ts">Target</a></code>
89

@@ -55,6 +56,7 @@ Types:
5556
- <code><a href="./src/resources/builds/builds.ts">Build</a></code>
5657
- <code><a href="./src/resources/builds/builds.ts">BuildTarget</a></code>
5758
- <code><a href="./src/resources/builds/builds.ts">CheckStep</a></code>
59+
- <code><a href="./src/resources/builds/builds.ts">CheckStepConclusion</a></code>
5860
- <code><a href="./src/resources/builds/builds.ts">BuildCompareResponse</a></code>
5961

6062
Methods:

packages/mcp-server/src/tools/builds/retrieve-builds.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import { isJqError, maybeFilter } from '@stainless-api/sdk-mcp/filtering';
43
import { Metadata, asErrorResult, asTextContentResult } from '@stainless-api/sdk-mcp/tools/types';
54

65
import { Tool } from '@modelcontextprotocol/sdk/types.js';
@@ -16,21 +15,14 @@ export const metadata: Metadata = {
1615

1716
export const tool: Tool = {
1817
name: 'retrieve_builds',
19-
description:
20-
"When using this tool, always use the `jq_filter` parameter to reduce the response size and improve performance.\n\nOnly omit if you're sure you don't need the data.\n\nRetrieve a build by its ID.\n\n# Response Schema\n```json\n{\n $ref: '#/$defs/build',\n $defs: {\n build: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Build ID'\n },\n config_commit: {\n type: 'string'\n },\n created_at: {\n type: 'string',\n format: 'date-time'\n },\n documented_spec: {\n anyOf: [ {\n type: 'object',\n properties: {\n content: {\n type: 'string'\n },\n type: {\n type: 'string',\n enum: [ 'content'\n ]\n }\n },\n required: [ 'content',\n 'type'\n ]\n },\n {\n type: 'object',\n properties: {\n expires: {\n type: 'string',\n format: 'date-time'\n },\n type: {\n type: 'string',\n enum: [ 'url'\n ]\n },\n url: {\n type: 'string'\n }\n },\n required: [ 'expires',\n 'type',\n 'url'\n ]\n }\n ]\n },\n object: {\n type: 'string',\n enum: [ 'build'\n ]\n },\n org: {\n type: 'string'\n },\n project: {\n type: 'string'\n },\n targets: {\n type: 'object',\n properties: {\n cli: {\n $ref: '#/$defs/build_target'\n },\n csharp: {\n $ref: '#/$defs/build_target'\n },\n go: {\n $ref: '#/$defs/build_target'\n },\n java: {\n $ref: '#/$defs/build_target'\n },\n kotlin: {\n $ref: '#/$defs/build_target'\n },\n node: {\n $ref: '#/$defs/build_target'\n },\n php: {\n $ref: '#/$defs/build_target'\n },\n python: {\n $ref: '#/$defs/build_target'\n },\n ruby: {\n $ref: '#/$defs/build_target'\n },\n terraform: {\n $ref: '#/$defs/build_target'\n },\n typescript: {\n $ref: '#/$defs/build_target'\n }\n }\n },\n updated_at: {\n type: 'string',\n format: 'date-time'\n }\n },\n required: [ 'id',\n 'config_commit',\n 'created_at',\n 'documented_spec',\n 'object',\n 'org',\n 'project',\n 'targets',\n 'updated_at'\n ]\n },\n build_target: {\n type: 'object',\n properties: {\n commit: {\n anyOf: [ {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: [ 'not_started'\n ]\n }\n },\n required: [ 'status'\n ]\n },\n {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: [ 'queued'\n ]\n }\n },\n required: [ 'status'\n ]\n },\n {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: [ 'in_progress'\n ]\n }\n },\n required: [ 'status'\n ]\n },\n {\n type: 'object',\n properties: {\n completed: {\n type: 'object',\n properties: {\n commit: {\n $ref: '#/$defs/commit'\n },\n conclusion: {\n type: 'string',\n enum: [ 'error',\n 'warning',\n 'note',\n 'success',\n 'merge_conflict',\n 'upstream_merge_conflict',\n 'fatal',\n 'payment_required',\n 'cancelled',\n 'timed_out',\n 'noop',\n 'version_bump'\n ]\n },\n merge_conflict_pr: {\n type: 'object',\n properties: {\n number: {\n type: 'number'\n },\n repo: {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n },\n owner: {\n type: 'string'\n }\n },\n required: [ 'name',\n 'owner'\n ]\n }\n },\n required: [ 'number',\n 'repo'\n ]\n }\n },\n required: [ 'commit',\n 'conclusion',\n 'merge_conflict_pr'\n ]\n },\n status: {\n type: 'string',\n enum: [ 'completed'\n ]\n }\n },\n required: [ 'completed',\n 'status'\n ]\n }\n ]\n },\n install_url: {\n type: 'string'\n },\n lint: {\n $ref: '#/$defs/check_step'\n },\n object: {\n type: 'string',\n enum: [ 'build_target'\n ]\n },\n status: {\n type: 'string',\n enum: [ 'not_started',\n 'codegen',\n 'postgen',\n 'completed'\n ]\n },\n test: {\n $ref: '#/$defs/check_step'\n },\n build: {\n $ref: '#/$defs/check_step'\n }\n },\n required: [ 'commit',\n 'install_url',\n 'lint',\n 'object',\n 'status',\n 'test'\n ]\n },\n commit: {\n type: 'object',\n properties: {\n repo: {\n type: 'object',\n properties: {\n branch: {\n type: 'string'\n },\n name: {\n type: 'string'\n },\n owner: {\n type: 'string'\n }\n },\n required: [ 'branch',\n 'name',\n 'owner'\n ]\n },\n sha: {\n type: 'string'\n }\n },\n required: [ 'repo',\n 'sha'\n ]\n },\n check_step: {\n anyOf: [ {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: [ 'not_started'\n ]\n }\n },\n required: [ 'status'\n ]\n },\n {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: [ 'queued'\n ]\n }\n },\n required: [ 'status'\n ]\n },\n {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: [ 'in_progress'\n ]\n }\n },\n required: [ 'status'\n ]\n },\n {\n type: 'object',\n properties: {\n completed: {\n type: 'object',\n properties: {\n conclusion: {\n type: 'string',\n enum: [ 'success',\n 'failure',\n 'skipped',\n 'cancelled',\n 'action_required',\n 'neutral',\n 'timed_out'\n ]\n },\n url: {\n type: 'string'\n }\n },\n required: [ 'conclusion',\n 'url'\n ]\n },\n status: {\n type: 'string',\n enum: [ 'completed'\n ]\n }\n },\n required: [ 'completed',\n 'status'\n ]\n }\n ]\n }\n }\n}\n```",
18+
description: 'Retrieve a build by its ID.',
2119
inputSchema: {
2220
type: 'object',
2321
properties: {
2422
buildId: {
2523
type: 'string',
2624
description: 'Build ID',
2725
},
28-
jq_filter: {
29-
type: 'string',
30-
title: 'jq Filter',
31-
description:
32-
'A jq filter to apply to the response to include certain fields. Consult the output schema in the tool description to see the fields that are available.\n\nFor example: to include only the `name` field in every object of a results array, you can provide ".results[].name".\n\nFor more information, see the [jq documentation](https://jqlang.org/manual/).',
33-
},
3426
},
3527
required: ['buildId'],
3628
},
@@ -40,11 +32,11 @@ export const tool: Tool = {
4032
};
4133

4234
export const handler = async (client: Stainless, args: Record<string, unknown> | undefined) => {
43-
const { buildId, jq_filter, ...body } = args as any;
35+
const { buildId, ...body } = args as any;
4436
try {
45-
return asTextContentResult(await maybeFilter(jq_filter, await client.builds.retrieve(buildId)));
37+
return asTextContentResult(await client.builds.retrieve(buildId));
4638
} catch (error) {
47-
if (error instanceof Stainless.APIError || isJqError(error)) {
39+
if (error instanceof Stainless.APIError) {
4840
return asErrorResult(error.message);
4941
}
5042
throw error;

src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
Builds,
3131
BuildsPage,
3232
CheckStep,
33+
CheckStepConclusion,
3334
} from './resources/builds/builds';
3435
import {
3536
Project,
@@ -810,6 +811,7 @@ export declare namespace Stainless {
810811
type Build as Build,
811812
type BuildTarget as BuildTarget,
812813
type CheckStep as CheckStep,
814+
type CheckStepConclusion as CheckStepConclusion,
813815
type BuildCompareResponse as BuildCompareResponse,
814816
type BuildsPage as BuildsPage,
815817
type BuildCreateParams as BuildCreateParams,
@@ -820,6 +822,7 @@ export declare namespace Stainless {
820822
export { Orgs as Orgs, type Org as Org, type OrgListResponse as OrgListResponse };
821823

822824
export type Commit = API.Commit;
825+
export type CommitConclusion = API.CommitConclusion;
823826
export type FileInput = API.FileInput;
824827
export type Target = API.Target;
825828
}

src/resources/builds/builds.ts

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,28 +166,28 @@ export namespace BuildTarget {
166166
}
167167

168168
export interface Completed {
169+
commit: Shared.Commit | null;
170+
171+
/**
172+
* deprecated
173+
*/
169174
completed: Completed.Completed;
170175

176+
conclusion: Shared.CommitConclusion;
177+
178+
merge_conflict_pr: Completed.MergeConflictPr | null;
179+
171180
status: 'completed';
172181
}
173182

174183
export namespace Completed {
184+
/**
185+
* deprecated
186+
*/
175187
export interface Completed {
176188
commit: Shared.Commit | null;
177189

178-
conclusion:
179-
| 'error'
180-
| 'warning'
181-
| 'note'
182-
| 'success'
183-
| 'merge_conflict'
184-
| 'upstream_merge_conflict'
185-
| 'fatal'
186-
| 'payment_required'
187-
| 'cancelled'
188-
| 'timed_out'
189-
| 'noop'
190-
| 'version_bump';
190+
conclusion: Shared.CommitConclusion;
191191

192192
merge_conflict_pr: Completed.MergeConflictPr | null;
193193
}
@@ -207,6 +207,20 @@ export namespace BuildTarget {
207207
}
208208
}
209209
}
210+
211+
export interface MergeConflictPr {
212+
number: number;
213+
214+
repo: MergeConflictPr.Repo;
215+
}
216+
217+
export namespace MergeConflictPr {
218+
export interface Repo {
219+
name: string;
220+
221+
owner: string;
222+
}
223+
}
210224
}
211225
}
212226

@@ -226,27 +240,39 @@ export namespace CheckStep {
226240
}
227241

228242
export interface Completed {
243+
/**
244+
* deprecated
245+
*/
229246
completed: Completed.Completed;
230247

248+
conclusion: BuildsAPI.CheckStepConclusion;
249+
231250
status: 'completed';
251+
252+
url: string | null;
232253
}
233254

234255
export namespace Completed {
256+
/**
257+
* deprecated
258+
*/
235259
export interface Completed {
236-
conclusion:
237-
| 'success'
238-
| 'failure'
239-
| 'skipped'
240-
| 'cancelled'
241-
| 'action_required'
242-
| 'neutral'
243-
| 'timed_out';
260+
conclusion: BuildsAPI.CheckStepConclusion;
244261

245262
url: string | null;
246263
}
247264
}
248265
}
249266

267+
export type CheckStepConclusion =
268+
| 'success'
269+
| 'failure'
270+
| 'skipped'
271+
| 'cancelled'
272+
| 'action_required'
273+
| 'neutral'
274+
| 'timed_out';
275+
250276
export interface BuildCompareResponse {
251277
base: Build;
252278

@@ -432,6 +458,7 @@ export declare namespace Builds {
432458
type Build as Build,
433459
type BuildTarget as BuildTarget,
434460
type CheckStep as CheckStep,
461+
type CheckStepConclusion as CheckStepConclusion,
435462
type BuildCompareResponse as BuildCompareResponse,
436463
type BuildsPage as BuildsPage,
437464
type BuildCreateParams as BuildCreateParams,

src/resources/builds/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export {
55
type Build,
66
type BuildTarget,
77
type CheckStep,
8+
type CheckStepConclusion,
89
type BuildCompareResponse,
910
type BuildCreateParams,
1011
type BuildListParams,

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export {
66
type Build,
77
type BuildTarget,
88
type CheckStep,
9+
type CheckStepConclusion,
910
type BuildCompareResponse,
1011
type BuildCreateParams,
1112
type BuildListParams,

src/resources/shared.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ export namespace Commit {
1616
}
1717
}
1818

19+
export type CommitConclusion =
20+
| 'error'
21+
| 'warning'
22+
| 'note'
23+
| 'success'
24+
| 'merge_conflict'
25+
| 'upstream_merge_conflict'
26+
| 'fatal'
27+
| 'payment_required'
28+
| 'cancelled'
29+
| 'timed_out'
30+
| 'noop'
31+
| 'version_bump';
32+
1933
export type FileInput = FileInput.Content | FileInput.URL;
2034

2135
export namespace FileInput {

0 commit comments

Comments
 (0)