Skip to content

Commit 561de7c

Browse files
committed
refactor(tools): remove bulk publish and unpublish tools from implementation
1 parent 4d6c837 commit 561de7c

File tree

2 files changed

+13
-143
lines changed

2 files changed

+13
-143
lines changed

src/types/tools.ts

Lines changed: 12 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ export const getEntryTools = () => {
129129
inputSchema: getSpaceEnvProperties({
130130
type: "object",
131131
properties: {
132-
entryId: {
132+
entryId: {
133133
oneOf: [
134134
{ type: "string" },
135-
{
136-
type: "array",
135+
{
136+
type: "array",
137137
items: { type: "string" },
138138
maxItems: 100,
139-
description: "Array of entry IDs to publish (max: 100)"
140-
}
139+
description: "Array of entry IDs to publish (max: 100)",
140+
},
141141
],
142-
description: "ID of the entry to publish, or an array of entry IDs (max: 100)"
142+
description: "ID of the entry to publish, or an array of entry IDs (max: 100)",
143143
},
144144
},
145145
required: ["entryId"],
@@ -152,17 +152,17 @@ export const getEntryTools = () => {
152152
inputSchema: getSpaceEnvProperties({
153153
type: "object",
154154
properties: {
155-
entryId: {
155+
entryId: {
156156
oneOf: [
157157
{ type: "string" },
158-
{
159-
type: "array",
158+
{
159+
type: "array",
160160
items: { type: "string" },
161161
maxItems: 100,
162-
description: "Array of entry IDs to unpublish (max: 100)"
163-
}
162+
description: "Array of entry IDs to unpublish (max: 100)",
163+
},
164164
],
165-
description: "ID of the entry to unpublish, or an array of entry IDs (max: 100)"
165+
description: "ID of the entry to unpublish, or an array of entry IDs (max: 100)",
166166
},
167167
},
168168
required: ["entryId"],
@@ -524,76 +524,6 @@ export const getSpaceEnvTools = () => {
524524
// Tool definitions for Bulk Actions
525525
export const getBulkActionTools = () => {
526526
return {
527-
BULK_PUBLISH: {
528-
name: "bulk_publish",
529-
description: "Publish multiple entries or assets at once",
530-
inputSchema: getSpaceEnvProperties({
531-
type: "object",
532-
properties: {
533-
entities: {
534-
type: "array",
535-
description: "Array of entries or assets to publish",
536-
items: {
537-
type: "object",
538-
properties: {
539-
sys: {
540-
type: "object",
541-
properties: {
542-
id: {
543-
type: "string",
544-
description: "ID of the entry or asset",
545-
},
546-
type: {
547-
type: "string",
548-
enum: ["Entry", "Asset"],
549-
description: "Type of entity (Entry or Asset)",
550-
},
551-
},
552-
required: ["id", "type"],
553-
},
554-
},
555-
required: ["sys"],
556-
},
557-
},
558-
},
559-
required: ["entities"],
560-
}),
561-
},
562-
BULK_UNPUBLISH: {
563-
name: "bulk_unpublish",
564-
description: "Unpublish multiple entries or assets at once",
565-
inputSchema: getSpaceEnvProperties({
566-
type: "object",
567-
properties: {
568-
entities: {
569-
type: "array",
570-
description: "Array of entries or assets to unpublish",
571-
items: {
572-
type: "object",
573-
properties: {
574-
sys: {
575-
type: "object",
576-
properties: {
577-
id: {
578-
type: "string",
579-
description: "ID of the entry or asset",
580-
},
581-
type: {
582-
type: "string",
583-
enum: ["Entry", "Asset"],
584-
description: "Type of entity (Entry or Asset)",
585-
},
586-
},
587-
required: ["id", "type"],
588-
},
589-
},
590-
required: ["sys"],
591-
},
592-
},
593-
},
594-
required: ["entities"],
595-
}),
596-
},
597527
BULK_VALIDATE: {
598528
name: "bulk_validate",
599529
description: "Validate multiple entries at once",

test/unit/tools.test.ts

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, beforeEach } from "vitest"
2-
import { getSpaceEnvProperties, getBulkActionTools } from "../../src/types/tools"
2+
import { getSpaceEnvProperties } from "../../src/types/tools"
33

44
describe("getSpaceEnvProperties", () => {
55
const originalEnv = process.env
@@ -74,63 +74,3 @@ describe("getSpaceEnvProperties", () => {
7474
expect(result.required).toContain("environmentId")
7575
})
7676
})
77-
78-
describe("getBulkActionTools", () => {
79-
const originalEnv = process.env
80-
81-
beforeEach(() => {
82-
process.env = { ...originalEnv }
83-
})
84-
85-
afterEach(() => {
86-
process.env = originalEnv
87-
})
88-
89-
it("should return bulk action tools with correct structure", () => {
90-
const bulkActionTools = getBulkActionTools()
91-
92-
// Check if all expected bulk actions are present
93-
expect(bulkActionTools).toHaveProperty("BULK_PUBLISH")
94-
expect(bulkActionTools).toHaveProperty("BULK_UNPUBLISH")
95-
expect(bulkActionTools).toHaveProperty("BULK_VALIDATE")
96-
97-
// Check BULK_PUBLISH structure
98-
expect(bulkActionTools.BULK_PUBLISH.name).toBe("bulk_publish")
99-
expect(bulkActionTools.BULK_PUBLISH.description).toBe("Publish multiple entries or assets at once")
100-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.properties).toHaveProperty("entities")
101-
102-
// Check BULK_UNPUBLISH structure
103-
expect(bulkActionTools.BULK_UNPUBLISH.name).toBe("bulk_unpublish")
104-
expect(bulkActionTools.BULK_UNPUBLISH.description).toBe("Unpublish multiple entries or assets at once")
105-
expect(bulkActionTools.BULK_UNPUBLISH.inputSchema.properties).toHaveProperty("entities")
106-
107-
// Check BULK_VALIDATE structure
108-
expect(bulkActionTools.BULK_VALIDATE.name).toBe("bulk_validate")
109-
expect(bulkActionTools.BULK_VALIDATE.description).toBe("Validate multiple entries at once")
110-
expect(bulkActionTools.BULK_VALIDATE.inputSchema.properties).toHaveProperty("entryIds")
111-
})
112-
113-
it("should include spaceId and environmentId in schema when environment variables are not set", () => {
114-
delete process.env.SPACE_ID
115-
delete process.env.ENVIRONMENT_ID
116-
117-
const bulkActionTools = getBulkActionTools()
118-
119-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.properties).toHaveProperty("spaceId")
120-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.properties).toHaveProperty("environmentId")
121-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.required).toContain("spaceId")
122-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.required).toContain("environmentId")
123-
})
124-
125-
it("should not include spaceId and environmentId in schema when environment variables are set", () => {
126-
process.env.SPACE_ID = "test-space-id"
127-
process.env.ENVIRONMENT_ID = "test-environment-id"
128-
129-
const bulkActionTools = getBulkActionTools()
130-
131-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.properties).not.toHaveProperty("spaceId")
132-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.properties).not.toHaveProperty("environmentId")
133-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.required || []).not.toContain("spaceId")
134-
expect(bulkActionTools.BULK_PUBLISH.inputSchema.required || []).not.toContain("environmentId")
135-
})
136-
})

0 commit comments

Comments
 (0)