MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / RpcIntelligenceClient

Class RpcIntelligenceClient

graph-ui/src/provider/rpc-client.ts:138–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138export class RpcIntelligenceClient {
139
140 constructor(protected readonly options: RpcClientOptions = {}) { }
141
142 /** Die Transportoptionen dieses Clients, je Aufruf frisch zusammengesetzt. */
143 protected callOptions(): CallToolOptions {
144 const opts: CallToolOptions = {};
145 if (this.options.base !== undefined) {
146 opts.base = this.options.base;
147 }
148 if (this.options.fetch !== undefined) {
149 opts.fetch = this.options.fetch;
150 }
151 if (this.options.signal !== undefined) {
152 opts.signal = this.options.signal;
153 }
154 return opts;
155 }
156
157 /**
158 * Rohtext eines Werkzeugs, mit der Fehlerzuordnung dieser Schicht.
159 *
160 * `signal` ist je Aufruf und nicht je Client, und das ist seit W7b der
161 * Unterschied, auf den es ankommt: der Client lebt so lange wie die Seite,
162 * eine Suchanfrage nur bis zum naechsten Tastendruck. Ein Signal am Client
163 * koennte also nur alles abbrechen oder nichts.
164 */
165 protected async text(
166 tool: string,
167 args: Record<string, unknown>,
168 call: { signal?: AbortSignal } = {},
169 ): Promise<string> {
170 try {
171 return await callToolText(tool, args, {
172 ...this.callOptions(),
173 ...(call.signal === undefined ? {} : { signal: call.signal }),
174 });
175 } catch (error) {
176 throw asEngineFailure(tool, error);
177 }
178 }
179
180 /** JSON eines Werkzeugs. `format: "json"` gehoert zur Bitte, nicht zur Antwort. */
181 protected async json(tool: string, args: Record<string, unknown>): Promise<unknown> {
182 try {
183 return await callToolJson(tool, { ...args, format: 'json' }, this.callOptions());
184 } catch (error) {
185 throw asEngineFailure(tool, error);
186 }
187 }
188
189 /** Ein Werkzeug, das diese Oberflaeche nicht hat, mit einer Begruendung statt einer Ausrede. */
190 protected refuse(tool: string): never {
191 throw new EngineUnavailableError(
192 'not-allowed',
193 `${tool}: die Read-only-Allowlist des Servers bietet dieses Werkzeug auf /rpc nicht an. ` +
194 'Schreibende Vorgaenge laufen ueber die CLI, nicht ueber diese Oberflaeche.',
195 tool,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected