/** * The schema graph this server publishes to a retrieval router. * * Why this exists: a router that selects only *tools* has to guess which fields * it will get back, so it either over-fetches (pays tokens for fields it never * reads) or under-fetches (never asks for a field it needed). SchemaRouter * (arXiv:2608.21375) measures both failures in exactly this setting — * heterogeneous agentic RAG over APIs plus vector and graph stores — and shows * the fix is field-aware routing driven by a declared schema. * * MCP already publishes tool names, descriptions and JSON schemas through * `tools/list`. What it cannot express is *meaning*: units, which fields are * authoritative here versus in an indexed copy, the domain vocabulary, and what * each tool is NOT for. That semantic layer is what this module holds, and * `telkomsel_get_capabilities` serves it. * * Keeping it a single source of truth matters: field selection defaults, the * published manifest and the projection helpers all read from these * definitions, so they cannot drift apart. */ export type EntityName = 'package' | 'product' | 'country' | 'credit' | 'offer'; /** What a field is for. Groups double as shorthands in the `fields` argument. */ export type FieldKind = 'identity' | 'routing' | 'pricing' | 'quota' | 'validity' | 'bonus' | 'billing' | 'marketing' | 'content' | 'internal'; export interface FieldSpec { name: string; type: 'string' | 'number' | 'boolean' | 'array' | 'object'; kind: FieldKind; /** Physical unit or format, when the value is not self-describing. */ unit?: string; /** * Multi-kilobyte HTML. Excluded from the default projection purely for size, * and always retrievable by naming it. Every heavy field also appears as a * `has*` boolean in the default projection, so a router can tell that the * content exists without paying to read it. */ heavy?: boolean; /** * True when the value is only meaningful within the request that produced it. * A router must never persist or compare these across calls. */ unstable?: boolean; /** * The value may be null, and the reason is part of the field's meaning rather * than a missing-data accident. A router must handle it explicitly. */ nullable?: boolean; /** * Computed by this server from other fields in the same record rather than * returned by the upstream. A router that needs the raw upstream value must * read the field this one was derived from. */ derived?: boolean; /** * Computed only when the caller names it, because the work is per row rather than * the payload. Excluded from the default projection, still reachable by name and * through its group. */ onDemand?: boolean; /** The complete set of values, when the field is closed. */ values?: readonly string[]; description: string; } /** * Package fields, as returned by the express-purchase catalogue. * * Note the units. `price` is an integer in rupiah with no decimals, but * `totalQuota` and `totalValidity` are *display strings* ("53 GB", "28 Days"), * not numbers, so they cannot be compared or summed arithmetically. A router * that assumes otherwise produces confidently wrong answers, which is why the * unit is declared rather than left to inspection. */ export declare const PACKAGE_FIELDS: FieldSpec[]; /** Fields of one entry in `package.bonus`. */ export declare const BONUS_FIELDS: FieldSpec[]; /** Fields of one of the 11 top-level products. */ export declare const PRODUCT_FIELDS: FieldSpec[]; /** Fields of one roaming destination. */ export declare const COUNTRY_FIELDS: FieldSpec[]; /** Fields of one pulsa denomination. */ export declare const CREDIT_FIELDS: FieldSpec[]; /** Fields of one featured offer group. */ export declare const OFFER_FIELDS: FieldSpec[]; export declare const ENTITY_FIELDS: Record; /** Sub-entity field sets, reachable by name rather than by entity. */ export declare const SUB_ENTITY_FIELDS: Record; /** * Default projection: everything except the multi-KB HTML blobs. * * This is deliberately *recall-preserving*. SchemaRouter measures that * minimising the selected-field count is counterproductive — answer accuracy * fell from 0.71 to 0.56 for negligible token savings — while * recall-preserving projection restored it. So the only fields withheld by * default are the ones whose cost is genuinely large, and each of them is * announced by a `has*` flag so nothing is hidden. */ export declare function defaultFieldNames(entity: EntityName): string[]; /** * Fields a compute expression may read. * * Scalar and published, without the multi-KB HTML blobs or the nested arrays: a * metric over prose is a footgun, and the point of a whitelist is that a caller * gets the list of names that work when they guess wrong. */ export declare function computableFieldNames(): string[]; /** Every declared field, including the heavy HTML ones. */ export declare function allFieldNames(entity: EntityName): string[]; /** Group names usable as shorthand in the `fields` argument. */ export declare function fieldGroups(entity: EntityName): string[]; /** * Domain vocabulary. * * The catalogue is written in Indonesian while an English question is the * common case, so a router doing concept matching needs the mapping. SchemaRouter * calls this the alias layer, and it is what lets a query about "data allowance" * match a field called `totalQuota` and a category called "Internet". */ export interface DomainConcept { concept: string; indonesian: string[]; fields: string[]; note?: string; } export declare const DOMAIN_CONCEPTS: DomainConcept[]; /** * Routing guidance for a retrieval router that also has dense, BM25 and * knowledge-graph routes available. */ export interface RoutingHint { preferThisRouteWhen: string[]; preferAnotherRouteWhen: string[]; } export declare const ROUTING_HINTS: RoutingHint; /** * Which fields a router may treat as ground truth from this route, and which * claims it must not answer from here. * * This is the contract that keeps a live route and an indexed route from * contradicting each other: an indexed copy may legitimately hold a stale * price, so a router must resolve anything in `authoritative` here rather than * from the index. */ export declare const AUTHORITATIVE_FIELDS: Record; export declare const NOT_AUTHORITATIVE_FOR: string[]; /** How this route labels itself in the provenance block of every response. */ export declare const ROUTE_META: { readonly route: 'telkomsel-product-mcp'; readonly source: 'https://www.telkomsel.com/api/express-purchase/v1'; readonly catalogSource: 'https://www.telkomsel.com'; readonly license: 'Catalogue data © Telkomsel, read from its public product endpoints. Not affiliated with or endorsed by Telkomsel.'; };