mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 06:41:08 +00:00
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import type { AnyAgentTool } from "./tools/common.js";
|
|
|
|
export type BundleMcpToolRuntime = {
|
|
tools: AnyAgentTool[];
|
|
dispose: () => Promise<void>;
|
|
};
|
|
|
|
export type McpServerCatalog = {
|
|
serverName: string;
|
|
launchSummary: string;
|
|
toolCount: number;
|
|
};
|
|
|
|
export type McpCatalogTool = {
|
|
serverName: string;
|
|
safeServerName: string;
|
|
toolName: string;
|
|
title?: string;
|
|
description?: string;
|
|
inputSchema: unknown;
|
|
fallbackDescription: string;
|
|
};
|
|
|
|
export type McpToolCatalog = {
|
|
version: number;
|
|
generatedAt: number;
|
|
servers: Record<string, McpServerCatalog>;
|
|
tools: McpCatalogTool[];
|
|
};
|
|
|
|
export type SessionMcpRuntime = {
|
|
sessionId: string;
|
|
sessionKey?: string;
|
|
workspaceDir: string;
|
|
configFingerprint: string;
|
|
createdAt: number;
|
|
lastUsedAt: number;
|
|
getCatalog: () => Promise<McpToolCatalog>;
|
|
markUsed: () => void;
|
|
callTool: (serverName: string, toolName: string, input: unknown) => Promise<CallToolResult>;
|
|
dispose: () => Promise<void>;
|
|
};
|
|
|
|
export type SessionMcpRuntimeManager = {
|
|
getOrCreate: (params: {
|
|
sessionId: string;
|
|
sessionKey?: string;
|
|
workspaceDir: string;
|
|
cfg?: OpenClawConfig;
|
|
}) => Promise<SessionMcpRuntime>;
|
|
bindSessionKey: (sessionKey: string, sessionId: string) => void;
|
|
resolveSessionId: (sessionKey: string) => string | undefined;
|
|
disposeSession: (sessionId: string) => Promise<void>;
|
|
disposeAll: () => Promise<void>;
|
|
listSessionIds: () => string[];
|
|
};
|