MCPServer
此内容尚不支持你的语言。
Interface for MCP server implementations. Provides methods for connecting, listing tools, calling tools, and cleanup.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”cacheToolsList
Section titled “cacheToolsList”cacheToolsList: boolean;customDataExtractor?
Section titled “customDataExtractor?”optional customDataExtractor?: MCPToolCustomDataExtractor;errorFunction?
Section titled “errorFunction?”optional errorFunction?: | MCPToolErrorFunction | null;Optional function to convert MCP tool failures into model-visible messages. Set to null to rethrow errors instead of converting them.
readonly name: string;toolFilter?
Section titled “toolFilter?”optional toolFilter?: | MCPToolFilterCallable | MCPToolFilterStatic;toolMetaResolver?
Section titled “toolMetaResolver?”optional toolMetaResolver?: MCPToolMetaResolver;useStructuredContent?
Section titled “useStructuredContent?”optional useStructuredContent?: boolean;Whether to use MCP structuredContent as the model-visible tool output when available.
Defaults to false to preserve the existing content-based output behavior.
Methods
Section titled “Methods”callTool()
Section titled “callTool()”callTool( toolName, args,meta?): Promise<CallToolResultContent>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
|
|
|
Returns
Section titled “Returns”Promise<CallToolResultContent>
callToolResult()?
Section titled “callToolResult()?”optional callToolResult( toolName, args, meta?): Promise<{ _meta?: Record<string, unknown>; content: object[]; isError?: boolean; structuredContent?: Record<string, unknown>;}>;Invoke a tool and return the full serializable MCP result.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
|
|
|
Returns
Section titled “Returns”Promise<{
_meta?: Record<string, unknown>;
content: object[];
isError?: boolean;
structuredContent?: Record<string, unknown>;
}>
close()
Section titled “close()”close(): Promise<void>;Returns
Section titled “Returns”Promise<void>
connect()
Section titled “connect()”connect(): Promise<void>;Returns
Section titled “Returns”Promise<void>
invalidateToolsCache()
Section titled “invalidateToolsCache()”invalidateToolsCache(): Promise<void>;Returns
Section titled “Returns”Promise<void>
listTools()
Section titled “listTools()”listTools(): Promise<object[]>;Returns
Section titled “Returns”Promise<object[]>