Files
openclaw/src/agents/pi-bundle-mcp-types.ts
2026-03-29 23:36:37 +01:00

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[];
};