Skip to content

๐Ÿคฏ LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

โœจ feat(agent-management): search the MCP marketplace before installing a market plugin (#21703)

Arvin Xuf6ceedee6a93
diff --git a/apps/cli/src/commands/plugin.test.ts b/apps/cli/src/commands/plugin.test.ts
index 2604af3f828..0a26b724ed1 100644
--- a/apps/cli/src/commands/plugin.test.ts
+++ b/apps/cli/src/commands/plugin.test.ts
@@ -6,6 +6,9 @@ import { registerPluginCommand } from './plugin';
const { mockTrpcClient } = vi.hoisted(() => ({
mockTrpcClient: {
+ market: {
+ getMcpList: { query: vi.fn() },
+ },
plugin: {
createOrInstallPlugin: { mutate: vi.fn() },
createPlugin: { mutate: vi.fn() },
@@ -29,7 +32,10 @@ describe('plugin command', () => {
exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => {}) as any);
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
mockGetTrpcClient.mockResolvedValue(mockTrpcClient);
- for (const method of Object.values(mockTrpcClient.plugin)) {
+ for (const method of [
+ ...Object.values(mockTrpcClient.plugin),
+ ...Object.values(mockTrpcClient.market),
+ ]) {
for (const fn of Object.values(method)) {
(fn as ReturnType<typeof vi.fn>).mockReset();
}
@@ -71,6 +77,65 @@ describe('plugin command', () => {
});
});
+ describe('search', () => {
+ it('should query the MCP marketplace and mark installed plugins', async () => {
+ mockTrpcClient.market.getMcpList.query.mockResolvedValue({
+ items: [
+ { description: 'Web search', identifier: 'tavily', name: 'Tavily' },
+ { description: 'Repos', identifier: 'github', name: 'GitHub' },
+ ],
+ totalCount: 2,
+ });
+ mockTrpcClient.plugin.getPlugins.query.mockResolvedValue([{ identifier: 'github' }]);
+
+ const program = createProgram();
+ await program.parseAsync([
+ 'node',
+ 'test',
+ 'plugin',
+ 'search',
+ 'search',
+ '--category',
+ 'web-search',
+ '--limit',
+ '5',
+ '--json',
+ 'identifier,installed',
+ ]);
+
+ expect(mockTrpcClient.market.getMcpList.query).toHaveBeenCalledWith({
+ category: 'web-search',
+ pageSize: 5,
+ q: 'search',
+ });
+ expect(consoleSpy).toHaveBeenCalledWith(
+ JSON.stringify(
+ [
+ { identifier: 'tavily', installed: false },
+ { identifier: 'github', installed: true },
+ ],
+ null,
+ 2,
+ ),
+ );
+ });
+
+ it('should browse without a query', async () => {
+ mockTrpcClient.market.getMcpList.query.mockResolvedValue({ items: [], totalCount: 0 });
+ mockTrpcClient.plugin.getPlugins.query.mockResolvedValue([]);
+
+ const program = createProgram();
+ await program.parseAsync(['node', 'test', 'plugin', 'search']);
+
+ expect(mockTrpcClient.market.getMcpList.query).toHaveBeenCalledWith({
+ category: undefined,
+ pageSize: 20,
+ q: undefined,
+ });
+ expect(consoleSpy).toHaveBeenCalledWith('No plugins found.');
+ });
+ });
+
describe('create', () => {
it('should create a plugin', async () => {
mockTrpcClient.plugin.createPlugin.mutate.mockResolvedValue({ identifier: 'my-plugin' });
diff --git a/apps/cli/src/commands/plugin.ts b/apps/cli/src/commands/plugin.ts
index b2558d72c6d..26257b13103 100644
--- a/apps/cli/src/commands/plugin.ts
+++ b/apps/cli/src/commands/plugin.ts
@@ -40,6 +40,61 @@ export function registerPluginCommand(program: Command) {
printTable(rows, ['ID', 'IDENTIFIER', 'TYPE', 'TITLE']);
});
+ // โ”€โ”€ search โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
+
+ plugin
+ .command('search [query]')
+ .description('Search MCP plugins in the marketplace')
+ .option('-c, --category <category>', 'Filter by category (e.g. developer, productivity)')
+ .option('-L, --limit <n>', 'Number of results', '20')
+ .option('--json [fields]', 'Output JSON, optionally specify fields (comma-separated)')
+ .action(
+ async (
+ query: string | undefined,
+ options: { category?: string; json?: string | boolean; limit?: string },
+ ) => {
+ const client = await getTrpcClient();
+ const [result, installed] = await Promise.all([
+ client.market.getMcpList.query({
+ category: options.category,
+ pageSize: Number.parseInt(options.limit || '20', 10),
+ q: query,
+ }),
+ client.plugin.getPlugins.query(),
+ ]);
+ const installedIds = new Set(
+ (Array.isArray(installed) ? installed : []).map((p: any) => p.identifier),
+ );
+ const items = (result?.items ?? []).map((item: any) => ({
+ ...item,
+ installed: installedIds.has(item.identifier),
+ }));
+
+ if (options.json !== undefined) {
+ const fields = typeof options.json === 'string' ? options.json : undefined;
+ outputJson(items, fields);
+ return;
+ }
+
+ if (items.length === 0) {
+ console.log('No plugins found.');
+ return;
+ }
+
+ const rows = items.map((p: any) => [
+ truncate(p.identifier || '', 30),
+ truncate(p.name || '', 30),
+ truncate(p.description || '', 50),
+ p.installed ? pc.green('installed') : '',
+ ]);
+
+ printTable(rows, ['IDENTIFIER', 'NAME', 'DESCRIPTION', 'STATUS']);
+ if (result?.totalCount > items.length) {
+ console.log(pc.dim(`Showing ${items.length} of ${result.totalCount} results.`));
+ }
+ },
+ );
+
// โ”€โ”€ create โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
plugin
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/agentManagement.test.ts b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/agentManagement.test.ts
index 9dc575bb163..ec2c7efbd2c 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/agentManagement.test.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/agentManagement.test.ts
@@ -18,6 +18,7 @@ const {
mockUpdateConfig,
mockFindById,
mockCreatePlugin,
+ mockGetMcpList,
mockGetMcpManifest,
mockQueryPlugins,
mockResolveConnectors,
@@ -26,6 +27,7 @@ const {
mockCountAgents: vi.fn(),
mockCreatePlugin: vi.fn(),
mockFindById: vi.fn(),
+ mockGetMcpList: vi.fn(),
mockGetMcpManifest: vi.fn(),
mockQueryPlugins: vi.fn(),
mockResolveConnectors: vi.fn(),
@@ -81,6 +83,7 @@ vi.mock('@/server/services/discover', () => ({
return {
getAssistantDetail: mockGetAssistantDetail,
getAssistantList: mockGetAssistantList,
+ getMcpList: mockGetMcpList,
getMcpManifest: mockGetMcpManifest,
};
}),
@@ -516,6 +519,62 @@ describe('agentManagementRuntime', () => {
});
});
+ // Agent Management could install a market plugin but had no way to find
+ // one, so the model either guessed an identifier or gave up.
+ describe('searchMarketTools', () => {
+ it('searches the MCP marketplace and marks installed plugins', async () => {
+ mockGetMcpList.mockResolvedValue({
+ items: [
+ { author: 'tavily', description: 'Web search', identifier: 'tavily', name: 'Tavily' },
+ { description: 'Repos', identifier: 'github', name: 'GitHub' },
+ ],
+ totalCount: 2,
+ });
+ mockQueryPlugins.mockResolvedValue([{ identifier: 'github' }]);
+
+ const result = await createRuntime().searchMarketTools({
+ category: 'web-search',
+ query: 'search',
+ });
+
+ expect(mockGetMcpList).toHaveBeenCalledWith({
+ category: 'web-search',
+ pageSize: 10,
+ q: 'search',
+ });
+ expect(result.success).toBe(true);
+ expect(result.content).toContain('- Tavily (tavily): Web search');
+ expect(result.content).toContain('- GitHub (github) [installed]: Repos');
+ expect(result.state.tools.map((t: any) => [t.identifier, t.installed])).toEqual([
+ ['tavily', false],
+ ['github', true],
+ ]);
+ });
+
+ it('caps the page size at the advertised max', async () => {
+ mockGetMcpList.mockResolvedValue({ items: [], totalCount: 0 });
+
+ const result = await createRuntime().searchMarketTools({ pageSize: 100 });
+
+ expect(mockGetMcpList).toHaveBeenCalledWith(expect.objectContaining({ pageSize: 20 }));
+ expect(result).toMatchObject({
+ content: 'Found 0 tool(s) in the marketplace.',
+ success: true,
+ });
+ });
+
+ it('reports a marketplace failure as a failed tool call', async () => {
+ mockGetMcpList.mockRejectedValue(new Error('unauthorized'));
+
+ const result = await createRuntime().searchMarketTools({ query: 'x' });
+
+ expect(result).toEqual({
+ content: 'Failed to search market tools: unauthorized',
+ success: false,
+ });
+ });
+ });
+
describe('installPlugin', () => {
it('installs a marketplace plugin with its manifest and pins it', async () => {
const manifest = { api: [{ name: 'run' }], identifier: 'plugin-b' };
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/agentBuilder.ts b/apps/server/src/services/toolExecution/serverRuntimes/agentBuilder.ts
index 9bb245079b6..a4e68fa4e5a 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/agentBuilder.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/agentBuilder.ts
@@ -22,6 +22,7 @@ import { DiscoverService } from '@/server/services/discover';
import { filterHiddenProviderModels } from '@/utils/aiProvider';
import { type ToolExecutionContext, type ToolExecutionResult } from '../types';
+import { searchMarketTools } from './marketToolSearch';
import {
NEXT_RUN_NOTE,
resolveOrInstallMarketPlugin,
@@ -164,40 +165,8 @@ export const agentBuilderRuntime: ServerRuntimeRegistration = {
}
},
- searchMarketTools: async (params: SearchMarketToolsParams): Promise<ToolExecutionResult> => {
- try {
- const response = await discoverService.getMcpList({
- category: params.category,
- pageSize: params.pageSize || 10,
- q: params.query,
- });
-
- const tools = response.items.map((item) => ({
- author: item.author,
- description: item.description,
- identifier: item.identifier,
- name: item.name,
- tags: item.tags,
- }));
-
- let summary = `Found ${response.totalCount} tool(s) in the marketplace.`;
- if (params.query) {
- summary = `Found ${response.totalCount} tool(s) matching "${params.query}".`;
- }
-
- const toolLines = tools
- .map((t) => `- ${t.name} (${t.identifier})${t.description ? ': ' + t.description : ''}`)
- .join('\n');
-
- return {
- content: `${summary}\n\n${toolLines}`,
- state: { query: params.query, tools, totalCount: response.totalCount },
- success: true,
- };
- } catch (error) {
- return handleError(error, 'Failed to search market tools');
- }
- },
+ searchMarketTools: (params: SearchMarketToolsParams): Promise<ToolExecutionResult> =>
+ searchMarketTools({ discoverService, pluginModel }, params),
updateConfig: async (
params: UpdateAgentConfigParams,
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/agentManagement.ts b/apps/server/src/services/toolExecution/serverRuntimes/agentManagement.ts
index b7513debdf9..85b03f84b94 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/agentManagement.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/agentManagement.ts
@@ -7,6 +7,7 @@ import {
type GetAgentDetailParams,
type InstallPluginParams,
type SearchAgentParams,
+ type SearchMarketToolsParams,
type UpdateAgentParams,
type UpdatePromptParams,
} from '@lobechat/builtin-tool-agent-management';
@@ -28,6 +29,7 @@ import { DiscoverService } from '@/server/services/discover';
import { type ToolExecutionContext, type ToolExecutionResult } from '../types';
import { startBackgroundSubAgent } from './backgroundSubAgent';
+import { searchMarketTools } from './marketToolSearch';
import {
NEXT_RUN_NOTE,
resolveOrInstallMarketPlugin,
@@ -442,6 +444,9 @@ export const agentManagementRuntime: ServerRuntimeRegistration = {
}
},
+ searchMarketTools: (params: SearchMarketToolsParams): Promise<ToolExecutionResult> =>
+ searchMarketTools({ discoverService, pluginModel }, params),
+
updateAgent: async (params: UpdateAgentParams): Promise<ToolExecutionResult> => {
try {
const { agentId } = params;
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/marketToolSearch.ts b/apps/server/src/services/toolExecution/serverRuntimes/marketToolSearch.ts
new file mode 100644
index 00000000000..4594774c4fa
--- /dev/null
+++ b/apps/server/src/services/toolExecution/serverRuntimes/marketToolSearch.ts
@@ -0,0 +1,66 @@
+import type { MarketToolItem, SearchMarketToolsParams } from '@lobechat/builtin-tool-agent-builder';
+
+import type { PluginModel } from '@/database/models/plugin';
+import type { DiscoverService } from '@/server/services/discover';
+
+import type { ToolExecutionResult } from '../types';
+
+/** Mirrors the "max: 20" advertised by every searchMarketTools manifest. */
+export const MAX_MARKET_TOOLS_PAGE_SIZE = 20;
+
+export interface MarketToolSearchDeps {
+ discoverService: Pick<DiscoverService, 'getMcpList'>;
+ pluginModel: Pick<PluginModel, 'query'>;
+}
+
+/**
+ * Server-side `searchMarketTools`, shared by Agent Builder and Agent Management.
+ *
+ * Each result is marked `installed` against the caller's installed plugins so
+ * the model can skip a redundant install and go straight to pinning the id.
+ */
+export const searchMarketTools = async (
+ { discoverService, pluginModel }: MarketToolSearchDeps,
+ params: SearchMarketToolsParams,
+): Promise<ToolExecutionResult> => {
+ try {
+ const pageSize = Math.min(Math.max(params.pageSize || 10, 1), MAX_MARKET_TOOLS_PAGE_SIZE);
+ const [response, installedPlugins] = await Promise.all([
+ discoverService.getMcpList({ category: params.category, pageSize, q: params.query }),
+ pluginModel.query(),
+ ]);
+ const installedIds = new Set(installedPlugins.map((plugin) => plugin.identifier));
+
+ const tools: MarketToolItem[] = response.items.map((item) => ({
+ author: item.author,
+ description: item.description,
+ icon: item.icon,
+ identifier: item.identifier,
+ installed: installedIds.has(item.identifier),
+ name: item.name,
+ tags: item.tags,
+ }));
+
+ const summary = params.query
+ ? `Found ${response.totalCount} tool(s) matching "${params.query}".`
+ : `Found ${response.totalCount} tool(s) in the marketplace.`;
+
+ const toolLines = tools
+ .map(
+ (t) =>
+ `- ${t.name} (${t.identifier})${t.installed ? ' [installed]' : ''}${t.description ? ': ' + t.description : ''}`,
+ )
+ .join('\n');
+
+ return {
+ content: tools.length > 0 ? `${summary}\n\n${toolLines}` : summary,
+ state: { query: params.query, tools, totalCount: response.totalCount },
+ success: true,
+ };
+ } catch (error) {
+ return {
+ content: `Failed to search market tools: ${(error as Error).message}`,
+ success: false,
+ };
+ }
+};
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index 2d7395c703e..838734c5a13 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -194,6 +194,7 @@
"builtins.lobe-agent-management.apiName.getAgentDetail": "Get agent detail",
"builtins.lobe-agent-management.apiName.installPlugin": "Install Skill",
"builtins.lobe-agent-management.apiName.searchAgent": "Search agents",
+ "builtins.lobe-agent-management.apiName.searchMarketTools": "Search Skill market",
"builtins.lobe-agent-management.apiName.updateAgent": "Update agent",
"builtins.lobe-agent-management.apiName.updatePrompt": "Update prompt",
"builtins.lobe-agent-management.inspector.callAgent.sync": "Calling:",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index 94b38233303..d91407362b2 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -194,6 +194,7 @@
"builtins.lobe-agent-management.apiName.getAgentDetail": "่Žทๅ–ไปฃ็†่ฏฆๆƒ…",
"builtins.lobe-agent-management.apiName.installPlugin": "ๅฎ‰่ฃ…ๆ’ไปถ",
"builtins.lobe-agent-management.apiName.searchAgent": "ๆœ็ดขไปฃ็†",
+ "builtins.lobe-agent-management.apiName.searchMarketTools": "ๆœ็ดขๆŠ€่ƒฝๅธ‚ๅœบ",
"builtins.lobe-agent-management.apiName.updateAgent": "ๆ›ดๆ–ฐไปฃ็†",
"builtins.lobe-agent-management.apiName.updatePrompt": "ๆ›ดๆ–ฐๆ็คบ่ฏ",
"builtins.lobe-agent-management.inspector.callAgent.sync": "ๆญฃๅœจๅ‘ผๅซ๏ผš",
diff --git a/packages/builtin-tool-agent-management/src/client/Inspector/index.ts b/packages/builtin-tool-agent-management/src/client/Inspector/index.ts
index c998870f5eb..bd1354b620e 100644
--- a/packages/builtin-tool-agent-management/src/client/Inspector/index.ts
+++ b/packages/builtin-tool-agent-management/src/client/Inspector/index.ts
@@ -1,3 +1,4 @@
+import { SearchMarketToolsInspector } from '@lobechat/builtin-tool-agent-builder/client';
import { type BuiltinInspector } from '@lobechat/types';
import { AgentManagementApiName } from '../../types';
@@ -23,6 +24,7 @@ export const AgentManagementInspectors: Record<string, BuiltinInspector> = {
[AgentManagementApiName.getAgentDetail]: GetAgentDetailInspector as BuiltinInspector,
[AgentManagementApiName.installPlugin]: InstallPluginInspector as BuiltinInspector,
[AgentManagementApiName.searchAgent]: SearchAgentInspector as BuiltinInspector,
+ [AgentManagementApiName.searchMarketTools]: SearchMarketToolsInspector as BuiltinInspector,
[AgentManagementApiName.updateAgent]: UpdateAgentInspector as BuiltinInspector,
[AgentManagementApiName.updatePrompt]: UpdatePromptInspector as BuiltinInspector,
};
diff --git a/packages/builtin-tool-agent-management/src/executor.ts b/packages/builtin-tool-agent-management/src/executor.ts
index dda482369b5..b891302ce99 100644
--- a/packages/builtin-tool-agent-management/src/executor.ts
+++ b/packages/builtin-tool-agent-management/src/executor.ts
@@ -33,6 +33,7 @@ import {
type GetAgentDetailParams,
type InstallPluginParams,
type SearchAgentParams,
+ type SearchMarketToolsParams,
type UpdateAgentParams,
type UpdatePromptParams,
} from './types';
@@ -103,6 +104,10 @@ class AgentManagementExecutor extends BaseExecutor<typeof AgentManagementApiName
return runtime.searchAgents(params);
};
+ searchMarketTools = async (params: SearchMarketToolsParams): Promise<BuiltinToolResult> => {
+ return runtime.searchMarketTools(params);
+ };
+
// ==================== Execution ====================
callAgent = async (
diff --git a/packages/builtin-tool-agent-management/src/manifest.ts b/packages/builtin-tool-agent-management/src/manifest.ts
index aaef4c70781..5f7902875ff 100644
--- a/packages/builtin-tool-agent-management/src/manifest.ts
+++ b/packages/builtin-tool-agent-management/src/manifest.ts
@@ -218,6 +218,32 @@ export const AgentManagementManifest: BuiltinToolManifest = {
},
},
+ {
+ description:
+ "Search for tools (MCP plugins) in the LobeHub marketplace. Use this when the user wants a capability that no plugin in the injected context provides, then pass a result's identifier to installPlugin with source 'market'. Each result reports whether it is already installed.",
+ name: AgentManagementApiName.searchMarketTools,
+ parameters: {
+ properties: {
+ category: {
+ description:
+ 'Optional: filter by category. Available categories: developer, productivity, web-search, tools, media-generate, etc.',
+ type: 'string',
+ },
+ pageSize: {
+ description: 'Optional: number of results to return (default: 10, max: 20).',
+ type: 'number',
+ },
+ query: {
+ description:
+ 'Optional: search keywords to find specific tools. Leave empty to browse all available tools.',
+ type: 'string',
+ },
+ },
+ required: [],
+ type: 'object',
+ },
+ },
+
// ==================== Prompt ====================
{
description:
diff --git a/packages/builtin-tool-agent-management/src/resolveManifest.test.ts b/packages/builtin-tool-agent-management/src/resolveManifest.test.ts
index d0c424dc128..7a4900ba6d8 100644
--- a/packages/builtin-tool-agent-management/src/resolveManifest.test.ts
+++ b/packages/builtin-tool-agent-management/src/resolveManifest.test.ts
@@ -21,6 +21,14 @@ describe('resolveAgentManagementManifest', () => {
expect(resolveAgentManagementManifest({})).toBe(AgentManagementManifest);
});
+ // installPlugin(source: 'market') needs an identifier the model can only get
+ // from a marketplace search; without one it guessed ids.
+ it('pairs market installPlugin with searchMarketTools', () => {
+ const names = apiNames(AgentManagementManifest);
+ expect(names).toContain(AgentManagementApiName.searchMarketTools);
+ expect(names).toContain(AgentManagementApiName.installPlugin);
+ });
+
it('advertises only the callAgent params every runtime honors', () => {
const callAgent = AgentManagementManifest.api.find(
(api) => api.name === AgentManagementApiName.callAgent,
@@ -45,6 +53,7 @@ describe('resolveAgentManagementManifest', () => {
// the rest of agent-management stays available
expect(names).toContain(AgentManagementApiName.createAgent);
expect(names).toContain(AgentManagementApiName.searchAgent);
+ expect(names).toContain(AgentManagementApiName.searchMarketTools);
expect(names).toContain(AgentManagementApiName.getAgentDetail);
// exactly one API removed
expect(names).toHaveLength(AgentManagementManifest.api.length - 1);
diff --git a/packages/builtin-tool-agent-management/src/systemRole.ts b/packages/builtin-tool-agent-management/src/systemRole.ts
index 13a40637567..b51d42f49a9 100644
--- a/packages/builtin-tool-agent-management/src/systemRole.ts
+++ b/packages/builtin-tool-agent-management/src/systemRole.ts
@@ -198,6 +198,7 @@ export const buildSystemPrompt = (
- **updatePrompt**: Update an agent's system prompt directly (preferred over updateAgent when only changing the prompt)
**Plugin Management:**
+- **searchMarketTools**: Search the MCP marketplace for plugins not listed in the injected context
- **installPlugin**: Install a plugin/tool for an agent (builtin, Composio, LobehubSkill, or MCP marketplace)${
includeCallAgent
? `
@@ -376,6 +377,7 @@ installPlugin(agentId, identifier, source)
**Notes:**
- Some official plugins (Composio, LobehubSkill) may require OAuth authorization
- Use the available plugins from the injected context to find valid plugin identifiers
+- For a capability the injected plugins don't cover, call searchMarketTools first and install a result with source 'market'; never guess a marketplace identifier
- After installation, the plugin is automatically enabled for the specified agent
</install_plugin_guide>
diff --git a/packages/builtin-tool-agent-management/src/types.ts b/packages/builtin-tool-agent-management/src/types.ts
index 6b04366bef1..63a31a5fe72 100644
--- a/packages/builtin-tool-agent-management/src/types.ts
+++ b/packages/builtin-tool-agent-management/src/types.ts
@@ -35,6 +35,9 @@ export const AgentManagementApiName = {
/** Search agents (user's own and marketplace) */
searchAgent: 'searchAgent',
+ /** Search MCP plugins in the marketplace */
+ searchMarketTools: 'searchMarketTools',
+
/** Update an existing agent */
updateAgent: 'updateAgent',
@@ -375,6 +378,14 @@ export interface DuplicateAgentState {
success: boolean;
}
+// ==================== Search Market Tools ====================
+
+export type {
+ MarketToolItem,
+ SearchMarketToolsParams,
+ SearchMarketToolsState,
+} from '@lobechat/agent-manager-runtime';
+
// ==================== Install Plugin ====================
export type InstallPluginSource = 'official' | 'market';
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index 1ef7a5b1d0e..40c7c88cb3d 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -74,6 +74,7 @@ export default {
'builtins.lobe-agent-management.apiName.getAgentDetail': 'Get agent detail',
'builtins.lobe-agent-management.apiName.installPlugin': 'Install Skill',
'builtins.lobe-agent-management.apiName.searchAgent': 'Search agents',
+ 'builtins.lobe-agent-management.apiName.searchMarketTools': 'Search Skill market',
'builtins.lobe-agent-management.apiName.updateAgent': 'Update agent',
'builtins.lobe-agent-management.apiName.updatePrompt': 'Update prompt',
'builtins.lobe-agent-management.inspector.callAgent.sync': 'Calling:',