mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-12 08:59:02 +08:00
feat(mcp): add hub server type definitions
- Add 'hub' to BuiltinMCPServerNames enum as '@cherry/hub' - Create GeneratedTool, SearchQuery, ExecInput, ExecOutput types - Add ExecutionContext and ConsoleMethods interfaces Amp-Thread-ID: https://ampcode.com/threads/T-019b4e7d-86a3-770d-82f8-9e646e7e597e Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
09e58d3756
commit
d454d5a27d
58
src/main/mcpServers/hub/types.ts
Normal file
58
src/main/mcpServers/hub/types.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import type { MCPServer, MCPTool } from '@types'
|
||||
|
||||
export interface GeneratedTool {
|
||||
serverId: string
|
||||
serverName: string
|
||||
toolName: string
|
||||
toolId: string
|
||||
functionName: string
|
||||
jsCode: string
|
||||
fn: (params: unknown) => Promise<unknown>
|
||||
signature: string
|
||||
returns: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface SearchQuery {
|
||||
query: string
|
||||
limit?: number
|
||||
}
|
||||
|
||||
export interface SearchResult {
|
||||
tools: string
|
||||
total: number
|
||||
}
|
||||
|
||||
export interface ExecInput {
|
||||
code: string
|
||||
}
|
||||
|
||||
export interface ExecOutput {
|
||||
result: unknown
|
||||
logs?: string[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface ToolRegistryOptions {
|
||||
ttl?: number
|
||||
}
|
||||
|
||||
export interface MCPToolWithServer extends MCPTool {
|
||||
server: MCPServer
|
||||
}
|
||||
|
||||
export interface ExecutionContext {
|
||||
__callTool: (toolId: string, params: unknown) => Promise<unknown>
|
||||
parallel: <T>(...promises: Promise<T>[]) => Promise<T[]>
|
||||
settle: <T>(...promises: Promise<T>[]) => Promise<PromiseSettledResult<T>[]>
|
||||
console: ConsoleMethods
|
||||
[functionName: string]: unknown
|
||||
}
|
||||
|
||||
export interface ConsoleMethods {
|
||||
log: (...args: unknown[]) => void
|
||||
warn: (...args: unknown[]) => void
|
||||
error: (...args: unknown[]) => void
|
||||
info: (...args: unknown[]) => void
|
||||
debug: (...args: unknown[]) => void
|
||||
}
|
||||
@ -754,7 +754,8 @@ export const BuiltinMCPServerNames = {
|
||||
python: '@cherry/python',
|
||||
didiMCP: '@cherry/didi-mcp',
|
||||
browser: '@cherry/browser',
|
||||
nowledgeMem: '@cherry/nowledge-mem'
|
||||
nowledgeMem: '@cherry/nowledge-mem',
|
||||
hub: '@cherry/hub'
|
||||
} as const
|
||||
|
||||
export type BuiltinMCPServerName = (typeof BuiltinMCPServerNames)[keyof typeof BuiltinMCPServerNames]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user