MCP Server
Functions
Functions
ClientAdapter
Create a proxied client adapter that dynamically forwards collection accesses to the underlying client. This allows CRUDTools to access any collection by name.
Signature:
ClientAdapter(newClient: NewClient<any>): OldClient & Record<string, any>
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
newClient | NewClient<any> | Yes |
Returns:
OldClient & Record<string, any> -
resolveToolLimits
Resolve tool limits from environment variables with fallback to defaults
Signature:
resolveToolLimits(env?: Record<string, string | undefined>): ResolvedToolLimits
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
env | Record<string, string | undefined> | No | - Environment object (defaults to process.env) |
Returns:
ResolvedToolLimits - Resolved tool limits with sane bounds
validateListLimit
Validate a requested limit against the configured maximum
Signature:
validateListLimit(requested: number | undefined, limits?: ResolvedToolLimits): number
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
requested | number | undefined | Yes | - The requested limit |
limits | ResolvedToolLimits | No | - Resolved tool limits |
Returns:
number -
validateOffset
Validate and normalize an offset value for pagination
Signature:
validateOffset(offset: number | undefined): number
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
offset | number | undefined | Yes | - The requested offset (can be number, undefined, or invalid) |
Returns:
number - A valid non-negative integer offset
getRAGClientConfig
Get RAG client configuration from environment variables
Signature:
getRAGClientConfig(): RAGClientConfig
Returns:
RAGClientConfig - Configuration object for RAGClient
createRAGClient
Create and connect a RAGClient instance
Factory function to create a connected RAGClient. Used by MCPServer to create a shared client instance for both RAGTools and DocumentTools.
Signature:
createRAGClient(): Promise<RAGClient>
Returns:
Promise<RAGClient> - Connected RAGClient instance
getConfigDir
Get the FlowState config directory path
Signature:
getConfigDir(): string
Returns:
string -
getConfigPath
Get the FlowState config file path
Signature:
getConfigPath(): string
Returns:
string -