mcp-server-debug-thinking
Version:
Graph-based MCP server for systematic debugging using Problem-Solution Trees and Hypothesis-Experiment-Learning cycles
183 lines • 4.96 kB
TypeScript
import type { NodeType, EdgeType } from "./graph.js";
export type { EdgeType } from "./graph.js";
/**
* グラフ操作用アクションタイプ
* MCPツールが受け付ける3つの基本操作
*/
export declare enum ActionType {
CREATE = "create",
CONNECT = "connect",
QUERY = "query"
}
/**
* ベースアクションインターフェース
* すべてのアクションが共通で持つactionフィールド
*/
interface BaseAction {
action: ActionType;
}
/**
* CREATEアクション: 新規ノードの作成
* parentIdを指定すると適切なエッジを自動生成
*/
export interface CreateAction extends BaseAction {
action: ActionType.CREATE;
nodeType: NodeType;
content: string;
parentId?: string;
metadata?: {
confidence?: number;
tags?: string[];
[key: string]: unknown;
};
}
/**
* CONNECTアクション: ノード間の明示的な関係作成
* 既存ノード間に意味的なエッジを追加
*/
export interface ConnectAction extends BaseAction {
action: ActionType.CONNECT;
from: string;
to: string;
type: EdgeType;
strength?: number;
metadata?: {
reasoning?: string;
evidence?: string;
[key: string]: unknown;
};
}
/**
* クエリタイプ: グラフに対する検索・分析操作
* Claude Codeでの実用性を重視した最小限のセット
*/
export type QueryType = "similar-problems" | "recent-activity";
/**
* QUERYアクション: グラフデータの検索・分析
* シンプルで実用的なパラメータのみ
*/
export interface QueryAction extends BaseAction {
action: ActionType.QUERY;
type: QueryType;
parameters?: {
pattern?: string;
limit?: number;
minSimilarity?: number;
};
}
/**
* GraphActionユニオン型
* MCPツールが受け付けるすべてのアクションの統合型
*/
export type GraphAction = CreateAction | ConnectAction | QueryAction;
/**
* アクション実行結果のレスポンス型定義
*/
/**
* CREATEアクションのレスポンス
* 作成されたノード情報と提案を含む
*/
export interface CreateResponse {
success: boolean;
nodeId?: string;
edgeId?: string;
message?: string;
suggestions?: {
relatedProblems?: string[];
possibleHypotheses?: string[];
recommendedExperiments?: string[];
};
similarProblems?: Array<{
nodeId: string;
content: string;
similarity: number;
status?: "open" | "investigating" | "solved" | "abandoned";
solutions: Array<{
nodeId: string;
content: string;
verified: boolean;
}>;
}>;
}
/**
* CONNECTアクションのレスポンス
* 矛盾検出機能付き
*/
export interface ConnectResponse {
success: boolean;
edgeId?: string;
message?: string;
conflicts?: {
conflictingEdges: string[];
explanation: string;
};
}
/**
* QUERYアクションの汎用レスポンス
* 実際の結果型はクエリタイプに依存
*/
export interface QueryResponse {
success: boolean;
results?: unknown;
message?: string;
queryTime?: number;
}
/**
* クエリタイプ別の詳細レスポンス型
* QueryResponse.resultsの実際の型定義
*/
/**
* similar-problemsクエリの結果型
* 類似問題とその解決策を包括的に返す
*/
export interface SimilarProblemsResult {
problems: Array<{
nodeId: string;
content: string;
similarity: number;
errorType?: string;
status: "open" | "investigating" | "solved" | "abandoned";
solutions: Array<{
nodeId: string;
content: string;
verified: boolean;
debugPath?: Array<{
nodeId: string;
type: NodeType;
content: string;
}>;
}>;
}>;
}
/**
* recent-activityクエリの結果型
* 最近のデバッグ活動を時系列で返す
*/
export interface RecentActivityResult {
nodes: Array<{
nodeId: string;
type: NodeType;
content: string;
createdAt: string;
parent?: {
nodeId: string;
type: NodeType;
content: string;
};
edges: Array<{
type: EdgeType;
targetNodeId: string;
direction: "from" | "to";
}>;
}>;
totalNodes: number;
}
/**
* 親子関係から適切なエッジタイプを自動判定
* CREATEアクションでparentId指定時に使用
* @param parentType 親ノードのタイプ
* @param childType 子ノードのタイプ
* @returns 適切なエッジタイプまたはnull(マッピングなしの場合)
*/
export declare function getAutoEdgeType(parentType: NodeType, childType: NodeType): EdgeType | null;
//# sourceMappingURL=graphActions.d.ts.map