endfield-mcp
Version:
MCP Server for Arknights: Endfield (TypeScript / stdio + Streamable HTTP)
69 lines (68 loc) • 2.51 kB
TypeScript
/**
* Character table core — store binding, table cache, and entry resolution.
*
* Owns the single source of truth for the parsed `CharacterTable.json`:
* the store reference, the lazy parse cache, and the multi-key resolver
* (id / CN name / EN name / engName). The operations module
* (`./characters.js`) and the profiles module (`./characterProfiles.js`)
* both resolve entries through `resolveCharacterEntry` so lookup
* precedence stays consistent across the character domain.
*
* ## Table shape
*
* CharacterTable.json: `{ [characterId: string]: CharacterEntry }`.
* The characterId format is `chr_NNNN_slug` (e.g. `chr_0002_endminm`).
* There are ~29 entries (as of the first export, 2026-06).
*
* Name / CV fields come through the i18n resolver (`./texts.ts`) so
* callers get actual strings, not int64 hashes.
*/
import { type LanguageCode, type LocalizedText } from "./texts.js";
import type { JsonStore } from "./stores.js";
/** The cvName sub-object shape. */
interface CvNameObject {
ChiCVName?: LocalizedText;
EngCVName?: LocalizedText;
JapCVName?: LocalizedText;
KorCVName?: LocalizedText;
charId?: string;
}
/** Raw CharacterTable.json entry. Only fields we read are typed. */
export interface CharacterEntry {
charId: string;
name: LocalizedText;
engName?: string;
phoneticName?: string;
profession: number;
rarity: number;
department?: string;
charTypeId?: string;
weaponType?: number;
mainAttrType?: number;
subAttrType?: number;
sortOrder?: number;
defaultWeaponId?: string;
superArmor?: number;
cvName?: CvNameObject;
profileRecord?: unknown[];
profileVoice?: unknown[];
attributes?: unknown[];
}
export declare function clearCharacterCaches(): void;
export declare function bindCharacterStore(store: JsonStore): void;
/**
* Return the parsed table sorted by `sortOrder` (ascending, stable).
* The operations module uses this to produce deterministic list/search output.
*/
export declare function sortedEntries(): Array<[string, CharacterEntry]>;
/**
* Resolve a character by id, CN name, requested-lang name, or engName.
* Returns `{id, entry}` on hit, `null` on miss. Shared by getCharacterInfo
* (operations) and getCharacterArchives/getCharacterVoices (profiles) so
* both use the same lookup precedence.
*/
export declare function resolveCharacterEntry(idOrName: string, lang?: LanguageCode): {
id: string;
entry: CharacterEntry;
} | null;
export {};