Skip to content

Commit 5ee0c36

Browse files
author
andypalmi
committed
feat(mcp): add search read tools
Add read-only search tools: platform_search_team_resources and platform_search_instances, covering team-wide resource search and instance-scoped search. Closes #7677
1 parent 482fad4 commit 5ee0c36

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

forge/ee/lib/mcp/tools/search.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const { z } = require('zod')
2+
3+
module.exports = [
4+
{
5+
name: 'platform_search_team_resources',
6+
title: 'Search Team Resources',
7+
description: `FlowFuse platform automation tool:
8+
Searches across a team's resources: applications, hosted instances, and remote instances (devices).
9+
Use this when the user wants to find something by name across the whole team, or when you have a name
10+
but not the ID of the resource you need.
11+
An empty or blank query returns an empty result set.
12+
To search only instances (hosted and remote), use platform_search_instances instead.`,
13+
annotations: { readOnlyHint: true, destructiveHint: false },
14+
inputSchema: {
15+
teamId: z.string().describe('The ID or hashid of the team to search within'),
16+
query: z.string().describe('The search term')
17+
},
18+
handler: async (args, { inject }) => {
19+
const response = await inject({ method: 'GET', url: `/api/v1/search?team=${args.teamId}&query=${encodeURIComponent(args.query)}` })
20+
return response
21+
}
22+
},
23+
{
24+
name: 'platform_search_instances',
25+
title: 'Search Instances',
26+
description: `FlowFuse platform automation tool:
27+
Searches the hosted instances and remote instances (devices) of a team.
28+
Use this when the user wants to find an instance by name and you do not already have its ID.
29+
An empty or blank query returns an empty result set.
30+
To search across all resource types (including applications), use platform_search_team_resources instead.`,
31+
annotations: { readOnlyHint: true, destructiveHint: false },
32+
inputSchema: {
33+
teamId: z.string().describe('The ID or hashid of the team to search within'),
34+
query: z.string().describe('The search term')
35+
},
36+
handler: async (args, { inject }) => {
37+
const response = await inject({ method: 'GET', url: `/api/v1/search/instances?team=${args.teamId}&query=${encodeURIComponent(args.query)}` })
38+
return response
39+
}
40+
}
41+
]

forge/routes/auth/permissions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const IMPLICIT_TOKEN_SCOPES = {
4848
// teams
4949
'user:team:list', // list teams
5050
'team:read', // get team details
51+
// search
52+
'team:search', // search team resources, search team instances
5153
// platform
5254
'stack:list',
5355
'flow-blueprint:list',

0 commit comments

Comments
 (0)