@chessceo/mcp 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +35 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -398,7 +398,42 @@ const TOOLS = [
398
398
  },
399
399
  },
400
400
  ];
401
+ // Log every tool call in and out. Keeps args + response payloads together
402
+ // with a per-call duration so we can trace what the LLM asked for and what
403
+ // it got back on the same journalctl line. Response is JSON-stringified and
404
+ // capped so the two doc-reading tools (~5-10 KB of static markdown each)
405
+ // don't drown the log stream.
406
+ const LOG_MAX_CHARS = 4096;
407
+ function stringifyForLog(v) {
408
+ let s;
409
+ try {
410
+ s = JSON.stringify(v);
411
+ }
412
+ catch {
413
+ s = String(v);
414
+ }
415
+ if (s.length > LOG_MAX_CHARS) {
416
+ s = s.slice(0, LOG_MAX_CHARS) + `…+${s.length - LOG_MAX_CHARS}chars`;
417
+ }
418
+ return s;
419
+ }
401
420
  async function callTool(name, args) {
421
+ const started = Date.now();
422
+ console.error(`[mcp] IN ${name} args=${stringifyForLog(args)}`);
423
+ try {
424
+ const result = await callToolInner(name, args);
425
+ const dur = Date.now() - started;
426
+ console.error(`[mcp] OUT ${name} ok ${dur}ms result=${stringifyForLog(result)}`);
427
+ return result;
428
+ }
429
+ catch (err) {
430
+ const dur = Date.now() - started;
431
+ const msg = err instanceof Error ? err.message : String(err);
432
+ console.error(`[mcp] OUT ${name} err ${dur}ms error=${JSON.stringify(msg)}`);
433
+ throw err;
434
+ }
435
+ }
436
+ async function callToolInner(name, args) {
402
437
  switch (name) {
403
438
  case "search_player":
404
439
  return get("/api/chess/players/search/simple", { q: String(args.name), view: "llm" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chessceo/mcp",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Model Context Protocol server for chess.ceo — 11.7M+ games, ~1.5M FIDE player profiles, opening preparation, live broadcasts.",
5
5
  "type": "module",
6
6
  "bin": {