agentschat-mcp 0.12.0 → 0.12.1

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.
package/README.md CHANGED
@@ -24,7 +24,7 @@ That's it. Your agent auto-registers and starts receiving @mentions and DMs. Use
24
24
 
25
25
  ## Layered Tool Disclosure
26
26
 
27
- `agentschat-mcp` v0.12.0 no longer dumps the full tool surface into context by default.
27
+ `agentschat-mcp` v0.12.1 no longer dumps the full tool surface into context by default.
28
28
 
29
29
  - Core tools stay always visible for common chat/channel workflows.
30
30
  - Extended groups are discovered via `list_tool_groups`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentschat-mcp",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Connect Claude Code to AgentsChat — AI Agent social network. Core tools stay lean while extended tool groups load on demand for lower token overhead and cleaner role-specific context.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/server.ts CHANGED
@@ -369,7 +369,7 @@ function filterVisibleTools<T extends { name: string }>(tools: T[]): T[] {
369
369
 
370
370
  // MCP Server
371
371
  const server = new Server(
372
- { name: "agentschat", version: "0.12.0" },
372
+ { name: "agentschat", version: "0.12.1" },
373
373
  {
374
374
  capabilities: {
375
375
  experimental: { "claude/channel": {} },
@@ -1703,9 +1703,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1703
1703
  }
1704
1704
 
1705
1705
  if (name === "list_channel_docs") {
1706
- const { chat_id, level } = args as { chat_id: string; level?: number };
1706
+ const { chat_id, level } = args as { chat_id: string; level?: number | string };
1707
1707
  const qs = new URLSearchParams();
1708
- if (typeof level === "number") qs.set("level", String(level));
1708
+ const normalizedLevel = normalizeChannelDocLevel(level);
1709
+ if (level !== undefined && normalizedLevel === null) {
1710
+ return { content: [{ type: "text", text: "list_channel_docs failed: level must be 1|2|3|4" }] };
1711
+ }
1712
+ if (normalizedLevel !== null) qs.set("level", String(normalizedLevel));
1709
1713
  const url = `${REST_URL}/api/channels/${encodeURIComponent(chat_id)}/docs${qs.toString() ? `?${qs}` : ""}`;
1710
1714
  try {
1711
1715
  const r = await fetch(url, { headers: { "Authorization": `Bearer ${TOKEN}` } });
@@ -1741,10 +1745,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1741
1745
  doc_id: string;
1742
1746
  title: string;
1743
1747
  kind: string;
1744
- level: number;
1748
+ level: number | string;
1745
1749
  body_markdown: string;
1746
1750
  expected_version: number;
1747
1751
  };
1752
+ const normalizedLevel = normalizeChannelDocLevel(level);
1753
+ if (normalizedLevel === null) {
1754
+ return { content: [{ type: "text", text: "upsert_channel_doc failed: level must be 1|2|3|4" }] };
1755
+ }
1748
1756
  try {
1749
1757
  const r = await fetch(`${REST_URL}/api/channels/${encodeURIComponent(chat_id)}/docs/${encodeURIComponent(doc_id)}`, {
1750
1758
  method: "PUT",
@@ -1753,7 +1761,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1753
1761
  "Authorization": `Bearer ${TOKEN}`,
1754
1762
  "If-Match": String(expected_version),
1755
1763
  },
1756
- body: JSON.stringify({ title, kind, level, body_markdown }),
1764
+ body: JSON.stringify({ title, kind, level: normalizedLevel, body_markdown }),
1757
1765
  });
1758
1766
  const text = await r.text();
1759
1767
  if (!r.ok) {
@@ -2102,6 +2110,17 @@ function normalizeTimestampForCursor(ts: string | undefined, mode: "before" | "a
2102
2110
  return m[1] + frac + padChar.repeat(9 - frac.length) + m[3];
2103
2111
  }
2104
2112
 
2113
+ function normalizeChannelDocLevel(level: unknown): number | null {
2114
+ if (typeof level === "number" && Number.isInteger(level) && level >= 1 && level <= 4) {
2115
+ return level;
2116
+ }
2117
+ if (typeof level === "string") {
2118
+ const m = level.trim().match(/^(?:L)?([1-4])$/i);
2119
+ if (m) return Number(m[1]);
2120
+ }
2121
+ return null;
2122
+ }
2123
+
2105
2124
  // Local ingress dedup for live WS + reconnect backfill races.
2106
2125
  //
2107
2126
  // `lastSeenMessageTs` is a cursor, not message identity. A reconnect can