Skip to content

Commit 1afce0f

Browse files
committed
filter out base64 images from get ITD info response
1 parent 03391d8 commit 1afce0f

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

package-lock.json

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
"@modelcontextprotocol/sdk": "^1.17.5",
3636
"commander": "^14.0.0",
3737
"fastify": "^5.5.0",
38+
"lodash-es": "^4.17.21",
3839
"undici": "^7.15.0",
3940
"dotenv": "^17.2.2",
4041
"zod": "^3.25.76"
4142
},
4243
"devDependencies": {
4344
"@eslint/js": "^9.24.0",
4445
"@stylistic/eslint-plugin": "^5.3.1",
46+
"@types/lodash-es": "^4.17.12",
4547
"@types/node": "^22.18.0",
4648
"c8": "^10.1.3",
4749
"eslint": "^9.34.0",

src/tools/marketplace/index.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,41 @@ suite('marketplace Item Type Definition info tool', async () => {
675675
},
676676
}, CallToolResultSchema)
677677

678+
const expectedITD = {
679+
apiVersion: 'software-catalog.mia-platform.eu/v1',
680+
kind: 'item-type-definition',
681+
metadata: {
682+
namespace: { scope: 'tenant', id: 'mia-platform' },
683+
displayName: 'Plugin ITD',
684+
name: 'plugin',
685+
visibility: { scope: 'console' },
686+
annotations: { foo: 'bar' },
687+
description: 'Description...',
688+
documentation: { url: 'http://example.com', type: 'external' },
689+
labels: { foo: 'bar' },
690+
links: [ { url: 'example.com', displayName: 'Example' } ],
691+
maintainers: [ { email: '[email protected]', name: 'John Doe' } ],
692+
publisher: {
693+
name: 'John Doe',
694+
url: 'http://example.com',
695+
},
696+
tags: [ 'foo', 'bar' ],
697+
},
698+
spec: {
699+
isVersioningSupported: true,
700+
type: 'plugin',
701+
scope: 'tenant',
702+
validation: {
703+
mechanism: 'json-schema',
704+
schema: { type: 'object' },
705+
},
706+
},
707+
__v: 1,
708+
}
709+
678710
t.assert.deepEqual(result.content, [
679711
{
680-
text: JSON.stringify(itemTypeDefinitions.at(0)),
712+
text: JSON.stringify(expectedITD),
681713
type: 'text',
682714
},
683715
])

src/tools/marketplace/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js'
1717
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
18+
import { unset } from 'lodash-es'
1819
import { z } from 'zod'
1920

2021
import { assertAiFeaturesEnabledForTenant } from '../utils/validations'
@@ -250,6 +251,9 @@ export function addMarketplaceCapabilities (server: McpServer, client: IAPIClien
250251

251252
const data = await client.marketplaceItemTypeDefinitionInfo(marketplaceITDTenantId, marketplaceITDName)
252253

254+
unset(data, 'metadata.icon')
255+
unset(data, 'metadata.publisher.image')
256+
253257
return {
254258
content: [
255259
{

0 commit comments

Comments
 (0)