diff --git a/app/COURSE_CONNECTOR.md b/app/COURSE_CONNECTOR.md index 0f8eeaf..6386f60 100644 --- a/app/COURSE_CONNECTOR.md +++ b/app/COURSE_CONNECTOR.md @@ -43,7 +43,8 @@ Overlapping upstream tool catalogs cannot change a tool's designated source. | PrincetonCourses | Course evaluations, review summaries, instructor information | None | | TigerPath | Degree requirement trees, aggregate planning statistics, own four-year plan | Add or remove a course in a semester | -There are 24 allowlisted read tools and 5 optional write tools. Whole-schedule +The baseline engine provides 24 allowlisted read tools and 5 optional write tools. +With three local public/coverage tools, the connector offers up to 27 read tools. Whole-schedule deletion, seat alerts, TigerHub registration, Canvas, calendar access, and PI workspaces are excluded. A saved plan is not a transcript or actual enrollment. @@ -122,3 +123,56 @@ require the assistant to report that gap instead of substituting an older term. Production CAS-to-Claude authorization, real personal-plan ownership enforcement, and saved-plan changes still require an authorized staging check. No production deployment or real plan mutation is part of these local checks. + +## Published data and coverage + +The connector now includes three local read tools independently of engine catalog +availability. `get_course_data_status(term)` checks the maintained catalog term +list, probes that exact term with `search_courses`, and checks the CS department +fallback. It does not read a student's +plans. `get_cs_course_schedule(term)` reads the official department page for that +exact semester, and rejects a page that silently selects a different term. +`search_prince_articles(query, page)` searches the Daily Princetonian public site, +returning bounded excerpts with source identity, article dates and canonical URLs. +This is not Clio and does not access its database, newsletters, retrieval service, +credentials or chats. Publication date, fetch time and unknown ingestion history +are separate fields. Public fetches send neither NetID nor session credentials. + +The existing TigerJunction importer owns catalog ingestion and freshness. PI uses +its existing `list_terms`, `search_courses`, `get_course_details` and +`get_course_sections` tools. There is no second OIT tool family or dependency on a +separate engine PR. The CS fallback and public Prince search remain independently +available during an engine outage. Imported results and saved-plan validation +may still be stale until the importer is repaired and backfilled. A successful +one-course probe establishes only that some data exists for the requested term, +not that every department or section is complete. Do not claim a database refresh +or a full-catalog verification based on that probe. + +Successful public reads are cached for at most five minutes per process/isolate, +with fetch timestamps and bounded cache sizes. Errors are not empty catalogs. +A working source is not proof it covers every department or the requested term. +The CS page provides course-level meetings, not every precept or lab; missing or +ambiguous times stay unknown. Prince reporting cannot establish degree policy or +current section availability. Ratings remain historical and a saved plan is not +a transcript. No automatic import, production mutation or registration is added. + +Local live checks on November 26, 2026 retrieved Spring 2027 COS 217 with +`MW 10:40 - 11:30` and dated Prince search results. The existing production engine +still returned only seven terms through Fall 2026 and no Spring 2027 COS results. +That is a historical observation, not proof of the current production state. +University-wide coverage requires verification of the importer backfill through +the existing engine tools; PI does not acquire or configure OIT credentials. + +Reproduce the read-only live public-source check from `app` with +`npx tsx scripts/smoke-current-course-data.ts 1274`. It uses the real MCP transport +with a local test identity, without production sessions or saved-plan writes. + +### PI-only requests + +The MCP instructions tell the host assistant to honor a student's PI-only request, +use the connector's own source tools and report gaps instead of silently switching +to web search or browser control. Official pages fetched server-side by PI remain +PI tool calls. An absent saved plan is not an empty transcript. These are assistant +instructions, not an access-control mechanism for the host's other tools. PI +cannot disable a separately enabled Chrome connector or verify that the host +complied. Strict tool isolation must be enforced in the host client. diff --git a/app/scripts/smoke-current-course-data.ts b/app/scripts/smoke-current-course-data.ts new file mode 100644 index 0000000..4d33736 --- /dev/null +++ b/app/scripts/smoke-current-course-data.ts @@ -0,0 +1,24 @@ +/** Read-only live source check through the actual connector MCP transport. + * Run from app: npx tsx scripts/smoke-current-course-data.ts 1274 + * Does not use production identities, credentials, plans or the production MCP. + */ +import assert from "node:assert/strict"; +import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client"; +import { COURSE_READ, handleCourseMcp } from "../src/server/course-mcp.ts"; +const term = Number(process.argv[2]); +assert.ok(Number.isInteger(term) && term >= 1000 && term <= 1999 && [2, 4].includes(term % 10), "Pass an explicit Fall/Spring term, e.g. 1274"); +const client = new Client({ name: "pi-live-public-smoke", version: "1" }); +const upstream = { list: async () => [], call: async () => { throw new Error("No engine in this public-source smoke test"); } }; +try { + await client.connect(new StreamableHTTPClientTransport(new URL("https://local.test/mcp"), { + fetch: (url, init) => handleCourseMcp(new Request(url, init), { netid: "teststudent", scope: [COURSE_READ] }, upstream), + })); + for (const [name, args] of [["get_cs_course_schedule", { term }], ["search_prince_articles", { query: "course offerings" }]] as const) { + const result = await client.callTool({ name, arguments: args }); + assert.notEqual(result.isError, true, JSON.stringify(result)); + const text = result.content?.find(c => c.type === "text"); + assert.ok(text?.type === "text"); + const data = JSON.parse(text.text); + console.log(JSON.stringify({ tool: name, status: "PASS", source: data.source, sourceUrl: data.sourceUrl, fetchedAt: data.fetchedAt, coverage: data.coverage, resultCount: data.courses?.length ?? data.articles?.length, sample: data.courses?.find((c: any) => c.code === "COS217") ?? data.articles?.[0] })); + } +} finally { await client.close(); } diff --git a/app/src/server/course-consent.ts b/app/src/server/course-consent.ts index f39157a..6fdb5e7 100644 --- a/app/src/server/course-consent.ts +++ b/app/src/server/course-consent.ts @@ -29,7 +29,7 @@ export function consentPage(details: ConsentDescription, handle: string, netid: ${details.clientDomain ? `Client domain verified as ${escapeHtml(details.clientDomain)}.` : "The application name is supplied by the client. Check the destination before connecting."}${details.redirectIsLoopback ? " This destination is a local app. Another local process could be listening there." : ""}