@wyattjoh/rfc 0.6.1 → 0.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wyattjoh/rfc",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Agent-facing CLI and MCP server for evidence-grounded IETF RFC research.",
5
5
  "keywords": [
6
6
  "cli",
@@ -38,14 +38,15 @@
38
38
  "typecheck": "tsc --noEmit -p tsconfig.json"
39
39
  },
40
40
  "dependencies": {
41
- "@effect/platform-node": "4.0.1",
42
- "@modelcontextprotocol/server": "2.3.1",
43
- "@wyattjoh/rfc-core": "0.3.1",
44
- "effect": "4.0.1"
41
+ "@effect/platform-node": "4.1.0",
42
+ "@effect/platform-node-shared": "4.1.0",
43
+ "@modelcontextprotocol/server": "2.4.0",
44
+ "@wyattjoh/rfc-core": "0.3.2",
45
+ "effect": "4.1.0"
45
46
  },
46
47
  "devDependencies": {
47
- "@modelcontextprotocol/client": "2.2.0",
48
- "@types/bun": "1.4.2",
48
+ "@modelcontextprotocol/client": "2.4.0",
49
+ "@types/bun": "1.4.4",
49
50
  "typescript": "7.0.2"
50
51
  },
51
52
  "engines": {
@@ -52,26 +52,28 @@ export const rfcAgentParameterDescriptions = {
52
52
  questions:
53
53
  "One to four questions, one per fact you need; each is answered independently from the same RFCs",
54
54
  question: "One self-contained question",
55
- rfcs: "One to four published RFC identifiers to search, for example RFC9110; their current successors are searched too",
56
- rfc: "Exact published RFC identifier, for example RFC9110",
55
+ rfcs: 'One to four published RFC identifiers to search, as strings or bare numbers, for example ["RFC9110", 8707]; their current successors are searched too',
56
+ rfc: "Exact published RFC identifier, as a string or bare number, for example RFC9110 or 9110",
57
57
  searchTerms:
58
58
  "One to four ordered topic-discovery terms for finding RFCs whose numbers you do not know; preserve caller order. Terms reach upstream logs, so never include private or user-specific details. Standard technical terms, including title words of an RFC you expect to match, are fine; never send a full question as a term unless the user explicitly chose it.",
59
59
  searchTerm:
60
60
  'Deliberate topic-discovery term sent verbatim in Datatracker query URLs and upstream logs. Matched as a literal case-insensitive substring of an RFC title or abstract, so use a short noun phrase such as "DNS over TLS"; a sentence fragment such as "DNS over TLS default port" matches nothing.',
61
- citationRfc: "Exact published RFC identifier containing the quotation",
61
+ citationRfc:
62
+ "Exact published RFC identifier containing the quotation, as a string or bare number, for example RFC9110 or 9110",
62
63
  claim: "One factual claim to check",
63
64
  quote: "Exact unchanged RFC quotation",
64
65
  offset:
65
66
  "Absolute UTF-8 byte offset copied from a research quote range; omit for a unique quotation",
66
67
  sourceRfc:
67
- "Exact published RFC identifier whose authoritative source text is requested, for example RFC9110",
68
+ "Exact published RFC identifier whose authoritative source text is requested, as a string or bare number, for example RFC9110 or 9110",
68
69
  sourceStart:
69
70
  "Inclusive absolute UTF-8 byte offset; give both startOffset and endOffset to read text",
70
71
  sourceEnd:
71
72
  "Exclusive absolute UTF-8 byte offset, as in citation provenance; give both offsets to read text",
72
73
  expectedSourceHash:
73
74
  "Hash from an earlier source-text response; reject a changed source instead of mixing pages",
74
- cacheRfc: "Exact named RFC source-cache entry, for example RFC9110",
75
+ cacheRfc:
76
+ "Exact named RFC source-cache entry, as a string or bare number, for example RFC9110 or 9110",
75
77
  confirm: "Must be true to confirm removal of the named cache entry",
76
78
  } as const;
77
79
 
package/src/mcp.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  } from "@wyattjoh/rfc-core";
15
15
  import { McpServer, type CallToolResult } from "@modelcontextprotocol/server";
16
16
  import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
17
- import { Schema } from "effect";
17
+ import { Schema, SchemaTransformation } from "effect";
18
18
  import {
19
19
  rfcAgentParameterDescriptions as descriptions,
20
20
  rfcAgentToolMetadata,
@@ -75,7 +75,7 @@ A \`current\` hit comes from the RFC that replaced the one named. Keep it distin
75
75
 
76
76
  ### rfc_research
77
77
 
78
- Inputs are \`questions\`, optional \`rfcs\`, and optional \`searchTerms\`; at least one of \`rfcs\` or \`searchTerms\` is required. Supply one to four ordered non-empty terms, each no longer than ${datatrackerTopicSearchTermMaximumCharacters} characters. Each term is matched as a literal case-insensitive substring of an RFC title or abstract, so use short noun phrases such as \`DNS over TLS\`; a sentence fragment such as \`DNS over TLS default port\` matches nothing. If the operator enabled optional full-text search, terms additionally match RFC keywords and body text. Terms are transmitted verbatim in upstream query URLs and may appear in diagnostics, errors, and upstream access logs. Never include private or user-specific details in a term, and do not send a natural-language question upstream unless it was explicitly chosen as a term.
78
+ Inputs are \`questions\`, optional \`rfcs\`, and optional \`searchTerms\`; at least one of \`rfcs\` or \`searchTerms\` is required. Every tool's RFC identifier may be a string such as \`RFC9110\` or a bare number such as \`9110\`. Supply one to four ordered non-empty terms, each no longer than ${datatrackerTopicSearchTermMaximumCharacters} characters. Each term is matched as a literal case-insensitive substring of an RFC title or abstract, so use short noun phrases such as \`DNS over TLS\`; a sentence fragment such as \`DNS over TLS default port\` matches nothing. If the operator enabled optional full-text search, terms additionally match RFC keywords and body text. Terms are transmitted verbatim in upstream query URLs and may appear in diagnostics, errors, and upstream access logs. Never include private or user-specific details in a term, and do not send a natural-language question upstream unless it was explicitly chosen as a term.
79
79
 
80
80
  ### rfc_verify_citation
81
81
 
@@ -126,6 +126,23 @@ Research and citation results report provider input tokens and estimated input c
126
126
  const describedString = (description: string) =>
127
127
  Schema.NonEmptyString.pipe(Schema.annotate({ description }));
128
128
 
129
+ /**
130
+ * RFC identifier accepted as a string such as "RFC9110" or a bare positive
131
+ * integer such as 9110. Models often send numbers, so integers decode to the
132
+ * canonical "RFC<number>" string before reaching the operation layer.
133
+ */
134
+ const rfcIdentifier = (description: string) =>
135
+ Schema.Union([Schema.NonEmptyString, Schema.Int.check(Schema.isGreaterThan(0))]).pipe(
136
+ Schema.annotate({ description }),
137
+ Schema.decodeTo(
138
+ Schema.NonEmptyString,
139
+ SchemaTransformation.transform({
140
+ decode: (value) => (typeof value === "number" ? `RFC${value}` : value),
141
+ encode: (value) => value,
142
+ }),
143
+ ),
144
+ );
145
+
129
146
  const TopicSearchTermSchema = Schema.String.check(
130
147
  Schema.isMinLength(1),
131
148
  Schema.isMaxLength(datatrackerTopicSearchTermMaximumCharacters),
@@ -136,7 +153,7 @@ const ResearchInputSchema = Schema.Struct({
136
153
  .check(Schema.isMinLength(1), Schema.isMaxLength(retrievalPolicy.maxQuestions))
137
154
  .pipe(Schema.annotate({ description: descriptions.questions })),
138
155
  rfcs: Schema.optionalKey(
139
- Schema.Array(describedString(descriptions.rfc))
156
+ Schema.Array(rfcIdentifier(descriptions.rfc))
140
157
  .check(Schema.isMinLength(1), Schema.isMaxLength(retrievalPolicy.maxRequestedRfcs))
141
158
  .pipe(Schema.annotate({ description: descriptions.rfcs })),
142
159
  ),
@@ -148,7 +165,7 @@ const ResearchInputSchema = Schema.Struct({
148
165
  });
149
166
 
150
167
  const CitationInputSchema = Schema.Struct({
151
- rfc: describedString(descriptions.citationRfc),
168
+ rfc: rfcIdentifier(descriptions.citationRfc),
152
169
  claim: describedString(descriptions.claim),
153
170
  quote: describedString(descriptions.quote),
154
171
  offset: Schema.optionalKey(
@@ -157,7 +174,7 @@ const CitationInputSchema = Schema.Struct({
157
174
  });
158
175
 
159
176
  const SourceTextInputSchema = Schema.Struct({
160
- rfc: describedString(descriptions.sourceRfc),
177
+ rfc: rfcIdentifier(descriptions.sourceRfc),
161
178
  startOffset: Schema.optionalKey(
162
179
  Schema.Natural.pipe(Schema.annotate({ description: descriptions.sourceStart })),
163
180
  ),
@@ -168,11 +185,11 @@ const SourceTextInputSchema = Schema.Struct({
168
185
  });
169
186
 
170
187
  const RfcInputSchema = Schema.Struct({
171
- rfc: describedString(descriptions.cacheRfc),
188
+ rfc: rfcIdentifier(descriptions.cacheRfc),
172
189
  });
173
190
 
174
191
  const SourceCacheRemoveInputSchema = Schema.Struct({
175
- rfc: describedString(descriptions.cacheRfc),
192
+ rfc: rfcIdentifier(descriptions.cacheRfc),
176
193
  confirm: Schema.Literal(true).pipe(Schema.annotate({ description: descriptions.confirm })),
177
194
  });
178
195