Skip to content

Commit 987baba

Browse files
committed
feat: add component mcp tools
1 parent 0c38029 commit 987baba

136 files changed

Lines changed: 2258 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/mcp/index.ts

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,50 @@ import { getSplitConfig } from './src/split'
101101
import { getStickyConfig } from './src/sticky'
102102
import { getCheckboxButtonConfig } from './src/checkbox-button'
103103
import { getCheckboxGroupConfig } from './src/checkbox-group'
104+
import { getColorSelectPanelConfig } from './src/color-select-panel'
105+
import { getCompanyConfig } from './src/company'
106+
import { getCountryConfig } from './src/country'
107+
import { getCropConfig } from './src/crop'
108+
import { getCurrencyConfig } from './src/currency'
109+
import { getDeptConfig } from './src/dept'
110+
import { getDialogSelectConfig } from './src/dialog-select'
111+
import { getDropRolesConfig } from './src/drop-roles'
112+
import { getDropTimesConfig } from './src/drop-times'
113+
import { getEspaceConfig } from './src/espace'
114+
import { getExceptionConfig } from './src/exception'
115+
import { getFallMenuConfig } from './src/fall-menu'
116+
import { getFloatButtonConfig } from './src/float-button'
117+
import { getFloatbarConfig } from './src/floatbar'
118+
import { getFluentEditorConfig } from './src/fluent-editor'
119+
import { getFullscreenConfig } from './src/fullscreen'
120+
import { getGridSelectConfig } from './src/grid-select'
121+
import { getGuideConfig } from './src/guide'
122+
import { getHrapproverConfig } from './src/hrapprover'
123+
import { getInfiniteScrollConfig } from './src/infinite-scroll'
124+
import { getIpAddressConfig } from './src/ip-address'
125+
import { getLinkMenuConfig } from './src/link-menu'
126+
import { getLocalesConfig } from './src/locales'
127+
import { getLogonUserConfig } from './src/logon-user'
128+
import { getLogoutConfig } from './src/logout'
129+
import { getMilestoneConfig } from './src/milestone'
130+
import { getNotifyConfig } from './src/notify'
131+
import { getNumberAnimationConfig } from './src/number-animation'
132+
import { getNumericConfig } from './src/numeric'
133+
import { getPopUploadConfig } from './src/pop-upload'
134+
import { getPopeditorConfig } from './src/popeditor'
135+
import { getQrCodeConfig } from './src/qr-code'
136+
import { getRolesConfig } from './src/roles'
137+
import { getSelectWrapperConfig } from './src/select-wrapper'
138+
import { getTagGroupConfig } from './src/tag-group'
139+
import { getTextPopupConfig } from './src/text-popup'
140+
import { getTimeLineConfig } from './src/time-line'
141+
import { getToggleMenuConfig } from './src/toggle-menu'
142+
import { getUserConfig } from './src/user'
143+
import { getUserAccountConfig } from './src/user-account'
144+
import { getUserContactConfig } from './src/user-contact'
145+
import { getUserHeadConfig } from './src/user-head'
146+
import { getUserLinkConfig } from './src/user-link'
147+
import { getWizardConfig } from './src/wizard'
104148

105149
export const createMcpTools = (
106150
instance: any,
@@ -215,7 +259,51 @@ export const getTinyVueMcpConfig = ({ t }: { t?: ((path: string) => string) | nu
215259
Split: getSplitConfig(),
216260
Sticky: getStickyConfig(),
217261
CheckboxButton: getCheckboxButtonConfig(),
218-
CheckboxGroup: getCheckboxGroupConfig()
262+
CheckboxGroup: getCheckboxGroupConfig(),
263+
ColorSelectPanel: getColorSelectPanelConfig(),
264+
Company: getCompanyConfig(),
265+
Country: getCountryConfig(),
266+
Crop: getCropConfig(),
267+
Currency: getCurrencyConfig(),
268+
Dept: getDeptConfig(),
269+
DialogSelect: getDialogSelectConfig(),
270+
DropRoles: getDropRolesConfig(),
271+
DropTimes: getDropTimesConfig(),
272+
Espace: getEspaceConfig(),
273+
Exception: getExceptionConfig(),
274+
FallMenu: getFallMenuConfig(),
275+
FloatButton: getFloatButtonConfig(),
276+
Floatbar: getFloatbarConfig(),
277+
FluentEditor: getFluentEditorConfig(),
278+
Fullscreen: getFullscreenConfig(),
279+
GridSelect: getGridSelectConfig(),
280+
Guide: getGuideConfig(),
281+
Hrapprover: getHrapproverConfig(),
282+
InfiniteScroll: getInfiniteScrollConfig(),
283+
IpAddress: getIpAddressConfig(),
284+
LinkMenu: getLinkMenuConfig(),
285+
Locales: getLocalesConfig(),
286+
LogonUser: getLogonUserConfig(),
287+
Logout: getLogoutConfig(),
288+
Milestone: getMilestoneConfig(),
289+
Notify: getNotifyConfig(),
290+
NumberAnimation: getNumberAnimationConfig(),
291+
Numeric: getNumericConfig(),
292+
PopUpload: getPopUploadConfig(),
293+
Popeditor: getPopeditorConfig(),
294+
QrCode: getQrCodeConfig(),
295+
Roles: getRolesConfig(),
296+
SelectWrapper: getSelectWrapperConfig(),
297+
TagGroup: getTagGroupConfig(),
298+
TextPopup: getTextPopupConfig(),
299+
TimeLine: getTimeLineConfig(),
300+
ToggleMenu: getToggleMenuConfig(),
301+
User: getUserConfig(),
302+
UserAccount: getUserAccountConfig(),
303+
UserContact: getUserContactConfig(),
304+
UserHead: getUserHeadConfig(),
305+
UserLink: getUserLinkConfig(),
306+
Wizard: getWizardConfig()
219307
}
220308
}
221309
}

packages/mcp/src/chart/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { z } from 'zod'
2+
import { defineComponentTool } from '../utils/defineComponentTool'
3+
import resourcesZh from './resouces.zh.md?raw'
4+
import resourcesEn from './resouces.en.md?raw'
5+
import { t } from '../utils/locale'
6+
7+
export const resources = { zh: resourcesZh, en: resourcesEn }
8+
9+
export const getChartConfig = () =>
10+
defineComponentTool({
11+
name: 'chart_component_tools',
12+
description: t('ai.chart.description'),
13+
tools: {
14+
getData: {
15+
paramsSchema: z.boolean().optional().describe(t('ai.chart.getData')),
16+
cb: (instance) => ({ type: 'text', text: JSON.stringify(instance.data || {}) })
17+
},
18+
refresh: {
19+
paramsSchema: z.boolean().optional().describe(t('ai.chart.refresh')),
20+
cb: (instance) => ({ type: 'text', text: 'Chart refreshed' })
21+
}
22+
}
23+
})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { z } from 'zod'
2+
import { defineComponentTool } from '../utils/defineComponentTool'
3+
import resourcesZh from './resouces.zh.md?raw'
4+
import resourcesEn from './resouces.en.md?raw'
5+
import { t } from '../utils/locale'
6+
7+
export const resources = { zh: resourcesZh, en: resourcesEn }
8+
9+
export const getColorSelectPanelConfig = () =>
10+
defineComponentTool({
11+
name: 'color_select_panel_component_tools',
12+
description: t('ai.colorSelectPanel.description'),
13+
tools: {
14+
getColor: {
15+
paramsSchema: z.boolean().optional().describe(t('ai.colorSelectPanel.getColor')),
16+
cb: (instance) => ({ type: 'text', text: instance.color || '' })
17+
},
18+
setColor: {
19+
paramsSchema: z.string().describe(t('ai.colorSelectPanel.setColor')),
20+
cb: (instance, params: string) => {
21+
instance.color = params
22+
return { type: 'text', text: 'Color updated' }
23+
}
24+
},
25+
open: {
26+
paramsSchema: z.boolean().optional().describe(t('ai.colorSelectPanel.open')),
27+
cb: (instance) => {
28+
instance.visible = true
29+
return { type: 'text', text: 'Panel opened' }
30+
}
31+
}
32+
}
33+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Color Select Panel Component
2+
3+
MCP tools for color select panel.
4+
5+
- getColor: Get selected color
6+
- setColor: Set color
7+
- open: Open panel
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Color Select Panel 颜色选择面板
2+
3+
颜色选择面板相关 MCP 工具。
4+
5+
- getColor: 获取选中颜色
6+
- setColor: 设置颜色
7+
- open: 打开面板

packages/mcp/src/company/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { z } from 'zod'
2+
import { defineComponentTool } from '../utils/defineComponentTool'
3+
import resourcesZh from './resouces.zh.md?raw'
4+
import resourcesEn from './resouces.en.md?raw'
5+
import { t } from '../utils/locale'
6+
7+
export const resources = { zh: resourcesZh, en: resourcesEn }
8+
9+
export const getCompanyConfig = () =>
10+
defineComponentTool({
11+
name: 'company_component_tools',
12+
description: t('ai.company.description'),
13+
tools: {
14+
getCompany: {
15+
paramsSchema: z.boolean().optional().describe(t('ai.company.getCompany')),
16+
cb: (instance) => ({ type: 'text', text: JSON.stringify(instance.company || {}) })
17+
},
18+
setCompany: {
19+
paramsSchema: z.object({ id: z.string(), name: z.string() }).describe(t('ai.company.setCompany')),
20+
cb: (instance, params) => {
21+
instance.company = params
22+
return { type: 'text', text: 'Company set' }
23+
}
24+
}
25+
}
26+
})
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Company Component
2+
3+
MCP tools for company selector.
4+
5+
- getCompany: Get current company
6+
- setCompany: Set company
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Company 公司选择
2+
3+
公司选择相关 MCP 工具。
4+
5+
- getCompany: 获取当前公司
6+
- setCompany: 设置公司

packages/mcp/src/country/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { z } from 'zod'
2+
import { defineComponentTool } from '../utils/defineComponentTool'
3+
import resourcesZh from './resouces.zh.md?raw'
4+
import resourcesEn from './resouces.en.md?raw'
5+
import { t } from '../utils/locale'
6+
7+
export const resources = { zh: resourcesZh, en: resourcesEn }
8+
9+
export const getCountryConfig = () =>
10+
defineComponentTool({
11+
name: 'country_component_tools',
12+
description: t('ai.country.description'),
13+
tools: {
14+
getCountry: {
15+
paramsSchema: z.boolean().optional().describe(t('ai.country.getCountry')),
16+
cb: (instance) => ({ type: 'text', text: instance.country || '' })
17+
},
18+
setCountry: {
19+
paramsSchema: z.string().describe(t('ai.country.setCountry')),
20+
cb: (instance, params: string) => {
21+
instance.country = params
22+
return { type: 'text', text: 'Country set' }
23+
}
24+
}
25+
}
26+
})
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Country Component
2+
3+
MCP tools for country selector.
4+
5+
- getCountry: Get selected country
6+
- setCountry: Set country

0 commit comments

Comments
 (0)