@wyattjoh/rfc 0.1.0 → 0.2.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 +12 -12
- package/package.json +4 -4
- package/src/agent-surface.ts +92 -0
- package/src/index.ts +18 -6
- package/src/main.ts +139 -53
- package/src/mcp.ts +34 -91
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ An MCP host should launch that command directly and treat standard output as pro
|
|
|
14
14
|
|
|
15
15
|
The model-facing tools are:
|
|
16
16
|
|
|
17
|
-
- `
|
|
18
|
-
- `
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
17
|
+
- `rfc_research_known_rfc`
|
|
18
|
+
- `rfc_research_topic`
|
|
19
|
+
- `rfc_verify_citation`
|
|
20
|
+
- `rfc_source_cache_status`
|
|
21
|
+
- `rfc_source_cache_remove`
|
|
22
|
+
- `rfc_auth_status`
|
|
23
23
|
|
|
24
|
-
Each successful tool call returns concise text plus the complete version-two result as validated structured content. Operational failures are MCP tool errors containing the same safe version-two error envelope as the CLI. Valid fail-closed research statuses and citation verdicts remain successful domain results. `
|
|
24
|
+
Each successful tool call returns concise text plus the complete version-two result as validated structured content. Operational failures are MCP tool errors containing the same safe version-two error envelope as the CLI. Valid fail-closed research statuses and citation verdicts remain successful domain results. `rfc_source_cache_remove` requires `confirm: true` and is marked destructive and idempotent.
|
|
25
25
|
|
|
26
26
|
Provider credentials are intentionally outside the model-facing mutation surface. The MCP can inspect safe credential status but can never accept, reveal, add, or remove a key. Configure the credential through `rfc auth add` before launching the server. The stored key is resolved separately for every semantic tool call.
|
|
27
27
|
|
|
@@ -59,11 +59,11 @@ A topic request sets `rfc` to `null` and supplies one to four ordered search ter
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
When standard input contains non-whitespace input, it is authoritative
|
|
62
|
+
When standard input contains non-whitespace input, it is authoritative, convenience flags and positional arguments are ignored, and JSON output remains the default. This is the unchanged automation protocol. When standard input is empty, human invocations may pass the question and optional RFC positionally (`rfc research "question" [RFC]`) or use `--question` with either `--rfc` or one to four repeatable `--search-term` flags. Argument-based operations render human-readable output by default; pass `--format json` for machine-readable output or `--format human` to render structured standard input for a person. `--cache-directory`, `--datatracker-api-url`, and `--typesafe-api-url` are available for deterministic preflight and local testing. Corpus-wide metadata management and bulk source operations are not part of the public client or CLI. Removed version-one `catalog status`, `catalog refresh`, and source-prefetch commands are rejected rather than emulated.
|
|
63
63
|
|
|
64
64
|
Known-RFC research fetches exact request-local metadata and recursively follows only bounded updating or obsoleting successors. Topic research issues one bounded title query and one bounded abstract query for each caller-supplied term, deterministically merges candidates in term order, and uses TypeSafe native multi-question scoring before source retrieval. Empty discovery returns `needs_review` without invoking TypeSafe and reports `atomicity: null` because no semantic judgment was made. Datatracker response bodies are streamed through a 1 MiB cap and decoded with bounded field lengths before any metadata reaches TypeSafe. Only the explicit search terms are sent to Datatracker; the natural-language question is not. Search terms appear in full Datatracker request URLs and can therefore appear in retrieval diagnostics, errors, and upstream access logs.
|
|
65
65
|
|
|
66
|
-
Requested RFC Editor plain text is cached individually with its canonical URL, integrity hash, ETag, and HTTP freshness deadline. Fresh text is reused without a network request. Stale text is conditionally revalidated and is never used when authoritative revalidation fails. `rfc cache status
|
|
66
|
+
Requested RFC Editor plain text is cached individually with its canonical URL, integrity hash, ETag, and HTTP freshness deadline. Fresh text is reused without a network request. Stale text is conditionally revalidated and is never used when authoritative revalidation fails. `rfc cache status RFC9110` reports a local hit or miss, while `rfc cache remove RFC9110` removes only that named entry; `--rfc RFC9110` remains an equivalent flag form. Neither command performs network access, and no bulk cache command is provided. Source retrieval accepts only a `200` body with an explicit `text/plain` Content-Type or a `304` conditional response, enforces one ten-second deadline across the complete operation, and rejects bodies above 8 MiB while streaming. Each evidence passage contains an exact quote, absolute UTF-8 byte offsets into the SHA-256 source, the declared `offsetUnit: "utf8-byte"`, canonical URLs, and a nullable best-effort section label. When a request ends without accepted evidence, the result can also include one request-local entry in `reviewCandidates`: the strongest semantically qualifying passage, falling back to the highest-ranked deterministic lexical passage, with exact canonical provenance and its semantic selection probability. The candidate is explicitly unaccepted and exists only to support bounded human or agent review without re-query loops. Human output labels them `Review candidate: not accepted evidence`. Version-two bundle diagnostics use `metadataMs` and `discoveredDocuments`, report full upstream URLs, attempts and statuses, request-local timings and counts, candidate or traversal bounds, explicit bounded traversal exits, and the source-cache outcome. Topic traces distinguish `upstreamRows`, all deduplicated `uniqueCandidates`, the 32-document `mergeLimit`, `semanticCandidates` sent to TypeSafe, and `selectedSources` advanced to RFC Editor retrieval. Public RFC documents omit relationship fields; currency paths and diagnostics carry only the relationships actually fetched. Topic discovery accepts each bounded first page and reports `topicTruncated: true` when Datatracker advertises additional rows or the deterministic merge reaches its cap; it never follows unbounded pagination.
|
|
67
67
|
|
|
68
68
|
Known-RFC currency research never silently replaces the requested RFC: update and obsoletion relationships are traversed deterministically with bounded, cycle-safe paths, and terminal current RFC contexts are researched independently. Requested/current evidence retains context-aware provenance and diagnostics. Incomplete successor coverage is reported as `partial` or `needs_review`; changed or ambiguous normative wording is not accepted as compatible.
|
|
69
69
|
|
|
@@ -79,7 +79,7 @@ Citation verification accepts canonical JSON with an RFC identifier, factual cla
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
The optional `offset` is an absolute UTF-8 byte offset into the exact authoritative RFC Editor source identified by the returned SHA-256 `sourceHash`; it is not a JavaScript UTF-16 string index. Results declare this unit as `provenance.offsetUnit: "utf8-byte"`, and `startOffset`/`endOffset` can be used to slice the hashed source bytes and recover the exact returned quote. Use it with `rfc verify-citation < citation.json`, or provide `--rfc`, `--claim`, `--quote`, and optional `--offset` convenience flags. The verifier performs one request-local exact Datatracker document lookup without successor traversal, loads the live source, locates the quote before making a semantic request, returns `fabricated` for absent text without calling TypeSafe, and rejects ambiguous repeated quotes unless an exact offset selects one occurrence. Present quotes receive version-two `verified`, `unsupported`, or `contradicted` results with exact provenance, probabilities, confidence, model identity, usage, timings, and retrieval traces including source-cache outcomes.
|
|
82
|
+
The optional `offset` is an absolute UTF-8 byte offset into the exact authoritative RFC Editor source identified by the returned SHA-256 `sourceHash`; it is not a JavaScript UTF-16 string index. Results declare this unit as `provenance.offsetUnit: "utf8-byte"`, and `startOffset`/`endOffset` can be used to slice the hashed source bytes and recover the exact returned quote. Use it with `rfc verify-citation < citation.json`, pass positional `RFC`, `claim`, and `quote` arguments, or provide `--rfc`, `--claim`, `--quote`, and optional `--offset` convenience flags. The verifier performs one request-local exact Datatracker document lookup without successor traversal, loads the live source, locates the quote before making a semantic request, returns `fabricated` for absent text without calling TypeSafe, and rejects ambiguous repeated quotes unless an exact offset selects one occurrence. Present quotes receive version-two `verified`, `unsupported`, or `contradicted` results with exact provenance, probabilities, confidence, model identity, usage, timings, and retrieval traces including source-cache outcomes.
|
|
83
83
|
|
|
84
84
|
Errors are versioned JSON envelopes on standard error and return a nonzero exit code. Valid domain outcomes, including `fabricated`, use standard output and a zero exit code.
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ Research and citation results report provider usage in `diagnostics.usage`. They
|
|
|
87
87
|
|
|
88
88
|
Every successful research or citation operation also updates the per-user running total at `~/.config/rfc/usage.json`. The versioned JSON file separates priced tokens, unpriced tokens, and operations with no provider-reported usage so `estimatedInputCostUsd` is never mistaken for a complete estimate when pricing is unavailable. Updates use a lock and atomic rename to preserve concurrent CLI invocations. A persistence failure leaves the successful result on standard output and emits a version-two `usage_accounting_failed` warning on standard error instead of encouraging a retry that could incur the provider charge again.
|
|
89
89
|
|
|
90
|
-
Run `rfc costs` to read those cumulative global totals without changing them.
|
|
90
|
+
Run `rfc costs` to read those cumulative global totals without changing them. Its default human output prints the update timestamp, operation and token coverage, and estimated USD total. `rfc costs --format json` emits the same validated `rfc_usage_totals` document stored on disk. When the usage file does not exist yet, the command reports zero totals and does not create it.
|
|
91
91
|
|
|
92
92
|
The opt-in `bun run benchmark:topic` command performs a normal topic research warm-up and then repeats the same schema-version-two request; it has no prefetch-only path. Set `RFC_TOPIC_BENCHMARK=1`, `RFC_CACHE_DIRECTORY`, and optionally `RFC_TOPIC_BENCHMARK_SEARCH_TERMS` as a JSON array of ordered terms. The JSON report separates live RFC discovery, RFC source-cache, document-selection, lexical, passage-selection, relation, semantic, and total p95 timings and includes the warm-up and measured retrieval traces. The current latency target is reported only as provisional while `precision-v2` is uncalibrated, so this explicit benchmark does not claim a release pass and never runs in the normal test suite.
|
|
93
93
|
|
|
@@ -110,7 +110,7 @@ For automation, explicitly pipe the key through standard input. It is never acce
|
|
|
110
110
|
cat /path/to/a-protected-key-input | rfc auth add --stdin
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
`auth status` reports only whether a key is configured and the service/name identity. `auth remove` is deterministic: its versioned result reports `removed: true` when a key existed and `removed: false` when it was already absent.
|
|
113
|
+
`auth status` reports only whether a key is configured and the service/name identity. `auth remove` is deterministic: its versioned JSON result reports `removed: true` when a key existed and `removed: false` when it was already absent. Human output is the default for auth commands; add `--format json` for the versioned process result. The key is not included in command output, diagnostics, snapshots, or error envelopes.
|
|
114
114
|
|
|
115
115
|
Bun maps the store to the host credential service: macOS Keychain, Linux Secret Service (libsecret, such as GNOME Keyring or KWallet), or Windows Credential Manager. Linux requires a running and unlocked Secret Service daemon; macOS requires Keychain access; Windows requires Credential Manager. This repository pins Bun `1.4.2` in `package.json` and tests against that version because `Bun.secrets` is experimental and may change.
|
|
116
116
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyattjoh/rfc",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Agent-facing CLI and MCP server for evidence-grounded IETF RFC research.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@effect/platform-node": "4.0.0-rc.
|
|
41
|
+
"@effect/platform-node": "4.0.0-rc.117",
|
|
42
42
|
"@modelcontextprotocol/server": "2.0.0",
|
|
43
43
|
"@wyattjoh/rfc-core": "0.1.0",
|
|
44
|
-
"effect": "4.0.0-rc.
|
|
44
|
+
"effect": "4.0.0-rc.117"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@modelcontextprotocol/client": "2.0.0",
|
|
48
48
|
"@types/bun": "1.4.2",
|
|
49
|
-
"typescript": "
|
|
49
|
+
"typescript": "7.0.2"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"bun": ">=1.4.2"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static URI for the complete model-facing RFC workflow reference.
|
|
3
|
+
*/
|
|
4
|
+
export const rfcMcpAgentReferenceUri = "rfc://docs/agent-workflow" as const;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Cross-tool instructions shared by MCP and native agent integrations.
|
|
8
|
+
*/
|
|
9
|
+
export const rfcMcpInstructions = `For an ordinary known-RFC answer, call rfc_research_known_rfc exactly once, then answer and stop. Do not call rfc_verify_citation after research to re-check returned evidence, including when status is needs_review. Do not run preflight tools. Do not read the agent-workflow resource.
|
|
10
|
+
|
|
11
|
+
Use this server as the complete backend for published IETF RFC questions. Do not answer RFC claims from memory or another provider. When the RFC identifier is unknown, call rfc_research_topic with { question, searchTerms } using one to four deliberate ordered technical terms. Use rfc_verify_citation only when the user supplied a quotation or explicitly requested a distinct paraphrase check.
|
|
12
|
+
|
|
13
|
+
For one simple atomic question, call one research tool once. Only when that result contains neither usable accepted evidence nor a review candidate may you make at most one targeted follow-up research call. Do not rephrase valid results to chase answered status or higher confidence. For up to two explicit independent questions, keep them as separate research calls; do not invent a split for an ambiguous request.
|
|
14
|
+
|
|
15
|
+
Topic search terms are transmitted verbatim in Datatracker URLs and may appear in upstream logs; never derive hidden terms or send the full question as a search term unless the user explicitly chose it.
|
|
16
|
+
|
|
17
|
+
Preserve research status exactly: answered, partial, unsupported, needs_review, or needs_split. Accepted evidence may support an answer. A review candidate is canonical but unaccepted and must be quoted only as qualified review material. Keep requested and current RFC contexts distinct and never silently substitute a successor.
|
|
18
|
+
|
|
19
|
+
Exact reproduction of accepted evidence needs no citation call. Verify at most two paraphrased claims once each with rfc_verify_citation, using the exact returned quote and its UTF-8 byte offset. If a direct verification verdict is fabricated, use at most one research call to locate current wording and one verification call for that replacement. Never guess wording or offsets. Unsupported, contradicted, or fabricated verdicts cannot support an unqualified claim.
|
|
20
|
+
|
|
21
|
+
Operational tool errors are not research statuses. Preserve their typed error code and stop rather than substituting stale text, another provider, or memory. If a tool error reports a missing credential, ask the human operator to run rfc auth add; never request or accept the secret through MCP. A usage-accounting warning follows a successful paid operation and must not trigger a retry.
|
|
22
|
+
|
|
23
|
+
Do not read the agent-workflow resource for ordinary research. Read ${rfcMcpAgentReferenceUri} only when handling a non-answer status, operational failure, citation-repair workflow, or a provenance, privacy, cost, or cache question.`;
|
|
24
|
+
|
|
25
|
+
const rfcAgentToolAnnotations = {
|
|
26
|
+
semantic: {
|
|
27
|
+
readOnlyHint: false,
|
|
28
|
+
destructiveHint: false,
|
|
29
|
+
idempotentHint: false,
|
|
30
|
+
openWorldHint: true,
|
|
31
|
+
},
|
|
32
|
+
localRead: {
|
|
33
|
+
readOnlyHint: true,
|
|
34
|
+
destructiveHint: false,
|
|
35
|
+
idempotentHint: true,
|
|
36
|
+
openWorldHint: false,
|
|
37
|
+
},
|
|
38
|
+
localRemove: {
|
|
39
|
+
readOnlyHint: false,
|
|
40
|
+
destructiveHint: true,
|
|
41
|
+
idempotentHint: true,
|
|
42
|
+
openWorldHint: false,
|
|
43
|
+
},
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Shared model-facing metadata for the MCP server and native agent integrations.
|
|
48
|
+
*/
|
|
49
|
+
export const rfcAgentToolMetadata = {
|
|
50
|
+
researchKnownRfc: {
|
|
51
|
+
name: "rfc_research_known_rfc",
|
|
52
|
+
title: "Research a known RFC",
|
|
53
|
+
description:
|
|
54
|
+
"Inputs: question, rfc. Research one atomic question against a known published RFC. If evidence or a review candidate is returned, answer from it without a verification call. Includes bounded RFC currency traversal, provenance, status, and diagnostics.",
|
|
55
|
+
annotations: rfcAgentToolAnnotations.semantic,
|
|
56
|
+
},
|
|
57
|
+
researchTopic: {
|
|
58
|
+
name: "rfc_research_topic",
|
|
59
|
+
title: "Discover and research RFCs",
|
|
60
|
+
description:
|
|
61
|
+
"Inputs: question, searchTerms (1-4). Research one atomic topic question. If evidence or a review candidate is returned, answer from it without a verification call. Terms are sent verbatim to Datatracker; results include provenance, status, and diagnostics.",
|
|
62
|
+
annotations: rfcAgentToolAnnotations.semantic,
|
|
63
|
+
},
|
|
64
|
+
verifyCitation: {
|
|
65
|
+
name: "rfc_verify_citation",
|
|
66
|
+
title: "Verify an RFC citation",
|
|
67
|
+
description:
|
|
68
|
+
"Inputs: rfc, claim, quote; optional offset. Check one factual claim against one exact RFC quotation. Returns a verified, unsupported, contradicted, or fabricated verdict with canonical provenance.",
|
|
69
|
+
annotations: rfcAgentToolAnnotations.semantic,
|
|
70
|
+
},
|
|
71
|
+
sourceCacheStatus: {
|
|
72
|
+
name: "rfc_source_cache_status",
|
|
73
|
+
title: "Inspect an RFC source cache entry",
|
|
74
|
+
description:
|
|
75
|
+
"Input: rfc. Inspect one named canonical RFC source-cache entry locally without network access.",
|
|
76
|
+
annotations: rfcAgentToolAnnotations.localRead,
|
|
77
|
+
},
|
|
78
|
+
sourceCacheRemove: {
|
|
79
|
+
name: "rfc_source_cache_remove",
|
|
80
|
+
title: "Remove an RFC source cache entry",
|
|
81
|
+
description:
|
|
82
|
+
"Inputs: rfc, confirm=true. Remove one named canonical RFC source-cache entry locally without network access; never performs bulk removal.",
|
|
83
|
+
annotations: rfcAgentToolAnnotations.localRemove,
|
|
84
|
+
},
|
|
85
|
+
authStatus: {
|
|
86
|
+
name: "rfc_auth_status",
|
|
87
|
+
title: "Inspect RFC provider credential status",
|
|
88
|
+
description:
|
|
89
|
+
"No inputs. Report only whether the stable TypeSafe credential identity is configured. Never returns, accepts, adds, or removes the credential.",
|
|
90
|
+
annotations: rfcAgentToolAnnotations.localRead,
|
|
91
|
+
},
|
|
92
|
+
} as const;
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
export { command, makeDefaultCliDependencies, run, toCliErrorEnvelope } from "./main";
|
|
2
|
+
export { rfcAgentToolMetadata, rfcMcpAgentReferenceUri, rfcMcpInstructions } from "./agent-surface";
|
|
3
|
+
export { createRfcMcpServer, rfcMcpAgentReference, runRfcMcpServer } from "./mcp";
|
|
2
4
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
executeAuthStatus,
|
|
6
|
+
executeCitationVerification,
|
|
7
|
+
executeResearch,
|
|
8
|
+
executeSourceCacheRemove,
|
|
9
|
+
executeSourceCacheStatus,
|
|
10
|
+
renderAuthStatus,
|
|
11
|
+
renderCitationVerification,
|
|
12
|
+
renderEvidenceBundle,
|
|
13
|
+
renderSourceCacheRemove,
|
|
14
|
+
renderSourceCacheStatus,
|
|
15
|
+
toRfcOperationErrorEnvelope,
|
|
16
|
+
type RfcOperationDependencies,
|
|
17
|
+
type RfcOperationOptions,
|
|
18
|
+
type RfcOperationResult,
|
|
19
|
+
type RfcOperationWarning,
|
|
20
|
+
} from "./operations";
|
|
9
21
|
export * from "./credentials";
|
|
10
22
|
export { defaultCliConfig, readCliConfig } from "./config";
|
package/src/main.ts
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
} from "@wyattjoh/rfc-core";
|
|
9
9
|
import { NodeServices } from "@effect/platform-node";
|
|
10
10
|
import { Console, Effect, Option } from "effect";
|
|
11
|
-
import { CliError, Command, Flag } from "effect/unstable/cli";
|
|
11
|
+
import { Argument, CliError, Command, Flag } from "effect/unstable/cli";
|
|
12
|
+
import packageMetadata from "../package.json" with { type: "json" };
|
|
12
13
|
import { runRfcMcpServer } from "./mcp";
|
|
13
14
|
import {
|
|
14
15
|
executeAuthStatus,
|
|
@@ -86,8 +87,10 @@ export interface RfcCliDependencies {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
const format = Flag.Literals("format", ["json", "human"] as const).pipe(
|
|
89
|
-
Flag.withDescription(
|
|
90
|
-
|
|
90
|
+
Flag.withDescription(
|
|
91
|
+
"Output format; defaults to human for arguments and JSON for structured standard input",
|
|
92
|
+
),
|
|
93
|
+
Flag.optional,
|
|
91
94
|
);
|
|
92
95
|
|
|
93
96
|
const cacheDirectory = Flag.String("cache-directory").pipe(
|
|
@@ -101,16 +104,32 @@ const datatrackerApiUrl = Flag.String("datatracker-api-url").pipe(
|
|
|
101
104
|
);
|
|
102
105
|
|
|
103
106
|
const question = Flag.String("question").pipe(
|
|
107
|
+
Flag.withAlias("q"),
|
|
104
108
|
Flag.withDescription("Short question used when standard input is not supplied"),
|
|
105
109
|
Flag.optional,
|
|
106
110
|
);
|
|
107
111
|
|
|
112
|
+
const questionArgument = Argument.String("question").pipe(
|
|
113
|
+
Argument.withDescription("Question to research when standard input is not supplied"),
|
|
114
|
+
Argument.optional,
|
|
115
|
+
);
|
|
116
|
+
|
|
108
117
|
const rfc = Flag.String("rfc").pipe(
|
|
118
|
+
Flag.withAlias("r"),
|
|
109
119
|
Flag.withDescription("Known RFC identifier for a short interactive request"),
|
|
110
120
|
Flag.optional,
|
|
111
121
|
);
|
|
112
122
|
|
|
113
|
-
const cacheRfc = Flag.String("rfc").pipe(
|
|
123
|
+
const cacheRfc = Flag.String("rfc").pipe(
|
|
124
|
+
Flag.withAlias("r"),
|
|
125
|
+
Flag.withDescription("Named RFC source cache entry"),
|
|
126
|
+
Flag.optional,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const rfcArgument = Argument.String("rfc").pipe(
|
|
130
|
+
Argument.withDescription("Named RFC identifier"),
|
|
131
|
+
Argument.optional,
|
|
132
|
+
);
|
|
114
133
|
|
|
115
134
|
const searchTerms = Flag.String("search-term").pipe(
|
|
116
135
|
Flag.withDescription("Ordered topic-discovery term; repeat one to four times"),
|
|
@@ -127,11 +146,21 @@ const claim = Flag.String("claim").pipe(
|
|
|
127
146
|
Flag.optional,
|
|
128
147
|
);
|
|
129
148
|
|
|
149
|
+
const claimArgument = Argument.String("claim").pipe(
|
|
150
|
+
Argument.withDescription("Factual claim to verify when standard input is not supplied"),
|
|
151
|
+
Argument.optional,
|
|
152
|
+
);
|
|
153
|
+
|
|
130
154
|
const quote = Flag.String("quote").pipe(
|
|
131
155
|
Flag.withDescription("Exact RFC quotation to verify when standard input is not supplied"),
|
|
132
156
|
Flag.optional,
|
|
133
157
|
);
|
|
134
158
|
|
|
159
|
+
const quoteArgument = Argument.String("quote").pipe(
|
|
160
|
+
Argument.withDescription("Exact RFC quotation to verify when standard input is not supplied"),
|
|
161
|
+
Argument.optional,
|
|
162
|
+
);
|
|
163
|
+
|
|
135
164
|
const offset = Flag.String("offset").pipe(
|
|
136
165
|
Flag.withDescription("Absolute UTF-8 byte offset for a repeated quotation"),
|
|
137
166
|
Flag.optional,
|
|
@@ -314,6 +343,37 @@ const parseCitationOffset = (value: string): number => {
|
|
|
314
343
|
return parsed;
|
|
315
344
|
};
|
|
316
345
|
|
|
346
|
+
const resolveArgumentInput = (
|
|
347
|
+
flagName: string,
|
|
348
|
+
flagValue: Option.Option<string>,
|
|
349
|
+
argumentValue: Option.Option<string>,
|
|
350
|
+
): string | undefined => {
|
|
351
|
+
if (Option.isSome(flagValue) && Option.isSome(argumentValue)) {
|
|
352
|
+
throw new InvalidInputError({
|
|
353
|
+
reason: `${flagName} cannot be combined with its positional argument`,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return Option.getOrUndefined(flagValue) ?? Option.getOrUndefined(argumentValue);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
const resolveRequiredArgumentInput = (
|
|
360
|
+
flagName: string,
|
|
361
|
+
flagValue: Option.Option<string>,
|
|
362
|
+
argumentValue: Option.Option<string>,
|
|
363
|
+
): string => {
|
|
364
|
+
const value = resolveArgumentInput(flagName, flagValue, argumentValue);
|
|
365
|
+
if (value === undefined) {
|
|
366
|
+
throw new InvalidInputError({ reason: `${flagName} or its positional argument is required` });
|
|
367
|
+
}
|
|
368
|
+
return value;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const resolveOutputFormat = (
|
|
372
|
+
selected: Option.Option<"json" | "human">,
|
|
373
|
+
structuredStandardInput = false,
|
|
374
|
+
): "json" | "human" =>
|
|
375
|
+
Option.getOrElse(selected, () => (structuredStandardInput ? "json" : "human"));
|
|
376
|
+
|
|
317
377
|
const renderUsageTotals = (totals: UsageTotals): string =>
|
|
318
378
|
[
|
|
319
379
|
`Updated: ${totals.updatedAt}`,
|
|
@@ -360,19 +420,23 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
360
420
|
cacheDirectory,
|
|
361
421
|
format,
|
|
362
422
|
rfc: cacheRfc,
|
|
423
|
+
rfcArgument,
|
|
363
424
|
},
|
|
364
|
-
Effect.fn(function* ({ cacheDirectory, format, rfc }) {
|
|
425
|
+
Effect.fn(function* ({ cacheDirectory, format, rfc, rfcArgument }) {
|
|
426
|
+
const selectedRfc = resolveRequiredArgumentInput("--rfc", rfc, rfcArgument);
|
|
365
427
|
const status = yield* Effect.tryPromise({
|
|
366
428
|
try: () =>
|
|
367
429
|
executeSourceCacheStatus(
|
|
368
|
-
|
|
430
|
+
selectedRfc,
|
|
369
431
|
operationOptions(cacheDirectory, Option.none(), Option.none()),
|
|
370
432
|
dependencies,
|
|
371
433
|
),
|
|
372
434
|
catch: (error) => error,
|
|
373
435
|
});
|
|
374
436
|
yield* writeStdout(
|
|
375
|
-
format === "human"
|
|
437
|
+
resolveOutputFormat(format) === "human"
|
|
438
|
+
? renderSourceCacheStatus(status)
|
|
439
|
+
: JSON.stringify(status),
|
|
376
440
|
);
|
|
377
441
|
}),
|
|
378
442
|
).pipe(Command.withDescription("Inspect one RFC source cache entry without network access"));
|
|
@@ -383,19 +447,23 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
383
447
|
cacheDirectory,
|
|
384
448
|
format,
|
|
385
449
|
rfc: cacheRfc,
|
|
450
|
+
rfcArgument,
|
|
386
451
|
},
|
|
387
|
-
Effect.fn(function* ({ cacheDirectory, format, rfc }) {
|
|
452
|
+
Effect.fn(function* ({ cacheDirectory, format, rfc, rfcArgument }) {
|
|
453
|
+
const selectedRfc = resolveRequiredArgumentInput("--rfc", rfc, rfcArgument);
|
|
388
454
|
const result = yield* Effect.tryPromise({
|
|
389
455
|
try: () =>
|
|
390
456
|
executeSourceCacheRemove(
|
|
391
|
-
|
|
457
|
+
selectedRfc,
|
|
392
458
|
operationOptions(cacheDirectory, Option.none(), Option.none()),
|
|
393
459
|
dependencies,
|
|
394
460
|
),
|
|
395
461
|
catch: (error) => error,
|
|
396
462
|
});
|
|
397
463
|
yield* writeStdout(
|
|
398
|
-
format === "human"
|
|
464
|
+
resolveOutputFormat(format) === "human"
|
|
465
|
+
? renderSourceCacheRemove(result)
|
|
466
|
+
: JSON.stringify(result),
|
|
399
467
|
);
|
|
400
468
|
}),
|
|
401
469
|
).pipe(Command.withDescription("Remove one RFC source cache entry without network access"));
|
|
@@ -412,8 +480,11 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
412
480
|
datatrackerApiUrl,
|
|
413
481
|
format,
|
|
414
482
|
rfc,
|
|
483
|
+
rfcArgument,
|
|
415
484
|
claim,
|
|
485
|
+
claimArgument,
|
|
416
486
|
quote,
|
|
487
|
+
quoteArgument,
|
|
417
488
|
offset,
|
|
418
489
|
typeSafeApiUrl,
|
|
419
490
|
},
|
|
@@ -427,21 +498,26 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
427
498
|
standardInput.trim().length > 0
|
|
428
499
|
? decodeCitationInput(standardInput)
|
|
429
500
|
: (() => {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
501
|
+
const selectedRfc = resolveRequiredArgumentInput(
|
|
502
|
+
"--rfc",
|
|
503
|
+
flags.rfc,
|
|
504
|
+
flags.rfcArgument,
|
|
505
|
+
);
|
|
506
|
+
const selectedClaim = resolveRequiredArgumentInput(
|
|
507
|
+
"--claim",
|
|
508
|
+
flags.claim,
|
|
509
|
+
flags.claimArgument,
|
|
510
|
+
);
|
|
511
|
+
const selectedQuote = resolveRequiredArgumentInput(
|
|
512
|
+
"--quote",
|
|
513
|
+
flags.quote,
|
|
514
|
+
flags.quoteArgument,
|
|
515
|
+
);
|
|
440
516
|
return decodeCitationRequest({
|
|
441
517
|
schemaVersion: 2,
|
|
442
|
-
rfc:
|
|
443
|
-
claim:
|
|
444
|
-
quote:
|
|
518
|
+
rfc: selectedRfc,
|
|
519
|
+
claim: selectedClaim,
|
|
520
|
+
quote: selectedQuote,
|
|
445
521
|
offset: Option.isSome(flags.offset)
|
|
446
522
|
? parseCitationOffset(flags.offset.value)
|
|
447
523
|
: null,
|
|
@@ -459,7 +535,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
459
535
|
});
|
|
460
536
|
yield* writeWarnings(result.warnings);
|
|
461
537
|
yield* writeStdout(
|
|
462
|
-
flags.format === "human"
|
|
538
|
+
resolveOutputFormat(flags.format, standardInput.trim().length > 0) === "human"
|
|
463
539
|
? renderCitationVerification(result.value)
|
|
464
540
|
: JSON.stringify(result.value),
|
|
465
541
|
);
|
|
@@ -473,8 +549,8 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
473
549
|
},
|
|
474
550
|
{
|
|
475
551
|
command:
|
|
476
|
-
'rfc verify-citation
|
|
477
|
-
description: "Verify a short interactive citation",
|
|
552
|
+
'rfc verify-citation RFC9110 "The client sends a request" "The client MUST send a request"',
|
|
553
|
+
description: "Verify a short interactive citation with positional arguments",
|
|
478
554
|
},
|
|
479
555
|
]),
|
|
480
556
|
);
|
|
@@ -486,7 +562,9 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
486
562
|
datatrackerApiUrl,
|
|
487
563
|
format,
|
|
488
564
|
question,
|
|
565
|
+
questionArgument,
|
|
489
566
|
rfc,
|
|
567
|
+
rfcArgument,
|
|
490
568
|
searchTerms,
|
|
491
569
|
typeSafeApiUrl,
|
|
492
570
|
},
|
|
@@ -499,25 +577,27 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
499
577
|
const request =
|
|
500
578
|
standardInput.trim().length > 0
|
|
501
579
|
? decodeResearchInput(standardInput)
|
|
502
|
-
:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
580
|
+
: (() => {
|
|
581
|
+
const selectedQuestion = resolveRequiredArgumentInput(
|
|
582
|
+
"--question",
|
|
583
|
+
flags.question,
|
|
584
|
+
flags.questionArgument,
|
|
585
|
+
);
|
|
586
|
+
const selectedRfc = resolveArgumentInput("--rfc", flags.rfc, flags.rfcArgument);
|
|
587
|
+
return selectedRfc === undefined
|
|
588
|
+
? decodeResearchRequest({
|
|
589
|
+
schemaVersion,
|
|
590
|
+
question: selectedQuestion,
|
|
591
|
+
rfc: null,
|
|
592
|
+
searchTerms: flags.searchTerms,
|
|
593
|
+
})
|
|
594
|
+
: decodeResearchRequest({
|
|
595
|
+
schemaVersion,
|
|
596
|
+
question: selectedQuestion,
|
|
597
|
+
rfc: selectedRfc,
|
|
598
|
+
searchTerms: flags.searchTerms.length === 0 ? undefined : flags.searchTerms,
|
|
599
|
+
});
|
|
600
|
+
})();
|
|
521
601
|
|
|
522
602
|
const result = yield* Effect.tryPromise({
|
|
523
603
|
try: () =>
|
|
@@ -530,7 +610,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
530
610
|
});
|
|
531
611
|
yield* writeWarnings(result.warnings);
|
|
532
612
|
yield* writeStdout(
|
|
533
|
-
flags.format === "human"
|
|
613
|
+
resolveOutputFormat(flags.format, standardInput.trim().length > 0) === "human"
|
|
534
614
|
? renderEvidenceBundle(result.value)
|
|
535
615
|
: JSON.stringify(result.value),
|
|
536
616
|
);
|
|
@@ -543,8 +623,8 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
543
623
|
description: "Use canonical JSON from standard input",
|
|
544
624
|
},
|
|
545
625
|
{
|
|
546
|
-
command: 'rfc research
|
|
547
|
-
description: "Use
|
|
626
|
+
command: 'rfc research "What does RFC 9110 require?" RFC9110',
|
|
627
|
+
description: "Use human-friendly positional arguments when standard input is empty",
|
|
548
628
|
},
|
|
549
629
|
]),
|
|
550
630
|
);
|
|
@@ -566,7 +646,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
566
646
|
catch: (error) => error,
|
|
567
647
|
});
|
|
568
648
|
|
|
569
|
-
if (format === "human") {
|
|
649
|
+
if (resolveOutputFormat(format) === "human") {
|
|
570
650
|
yield* writeStdout(
|
|
571
651
|
result.replaced
|
|
572
652
|
? "TypeSafe API key replaced in the platform credential store"
|
|
@@ -589,7 +669,9 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
589
669
|
try: () => executeAuthStatus(dependencies),
|
|
590
670
|
catch: (error) => error,
|
|
591
671
|
});
|
|
592
|
-
yield* writeStdout(
|
|
672
|
+
yield* writeStdout(
|
|
673
|
+
resolveOutputFormat(format) === "human" ? renderAuthStatus(result) : JSON.stringify(result),
|
|
674
|
+
);
|
|
593
675
|
}),
|
|
594
676
|
).pipe(Command.withDescription("Inspect TypeSafe credential configuration without revealing it"));
|
|
595
677
|
|
|
@@ -601,7 +683,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
601
683
|
try: () => removeStoredCredential(dependencies.credentialStore),
|
|
602
684
|
catch: (error) => error,
|
|
603
685
|
});
|
|
604
|
-
if (format === "human") {
|
|
686
|
+
if (resolveOutputFormat(format) === "human") {
|
|
605
687
|
yield* writeStdout(
|
|
606
688
|
result.removed
|
|
607
689
|
? "TypeSafe API key removed from the platform credential store"
|
|
@@ -628,7 +710,11 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
628
710
|
try: dependencies.readUsage,
|
|
629
711
|
catch: (error) => error,
|
|
630
712
|
});
|
|
631
|
-
yield* writeStdout(
|
|
713
|
+
yield* writeStdout(
|
|
714
|
+
resolveOutputFormat(format) === "human"
|
|
715
|
+
? renderUsageTotals(totals)
|
|
716
|
+
: JSON.stringify(totals),
|
|
717
|
+
);
|
|
632
718
|
}),
|
|
633
719
|
).pipe(Command.withDescription("Print cumulative per-user RFC usage costs"));
|
|
634
720
|
|
|
@@ -754,7 +840,7 @@ export const run = async (
|
|
|
754
840
|
|
|
755
841
|
try {
|
|
756
842
|
const program = Command.runWith(makeApplication(dependencies), {
|
|
757
|
-
version:
|
|
843
|
+
version: packageMetadata.version,
|
|
758
844
|
renderErrors: false,
|
|
759
845
|
})(argv);
|
|
760
846
|
|
package/src/mcp.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { McpServer, type CallToolResult } from "@modelcontextprotocol/server";
|
|
12
12
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
13
13
|
import { Schema } from "effect";
|
|
14
|
+
import { rfcAgentToolMetadata, rfcMcpAgentReferenceUri, rfcMcpInstructions } from "./agent-surface";
|
|
14
15
|
import { AuthStatusSchema } from "./credentials";
|
|
15
16
|
import {
|
|
16
17
|
executeAuthStatus,
|
|
@@ -30,29 +31,7 @@ import {
|
|
|
30
31
|
type RfcOperationWarning,
|
|
31
32
|
} from "./operations";
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
* Static URI for the complete model-facing RFC workflow reference.
|
|
35
|
-
*/
|
|
36
|
-
export const rfcMcpAgentReferenceUri = "rfc://docs/agent-workflow" as const;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Cross-tool instructions advertised during MCP initialization.
|
|
40
|
-
*/
|
|
41
|
-
export const rfcMcpInstructions = `For an ordinary known-RFC answer, call research_known_rfc exactly once, then answer and stop. Do not call verify_citation after research to re-check returned evidence, including when status is needs_review. Do not run preflight tools. Do not read the agent-workflow resource.
|
|
42
|
-
|
|
43
|
-
Use this server as the complete backend for published IETF RFC questions. Do not answer RFC claims from memory or another provider. When the RFC identifier is unknown, call research_topic with { question, searchTerms } using one to four deliberate ordered technical terms. Use verify_citation only when the user supplied a quotation or explicitly requested a distinct paraphrase check.
|
|
44
|
-
|
|
45
|
-
For one simple atomic question, call one research tool once. Only when that result contains neither usable accepted evidence nor a review candidate may you make at most one targeted follow-up research call. Do not rephrase valid results to chase answered status or higher confidence. For up to two explicit independent questions, keep them as separate research calls; do not invent a split for an ambiguous request.
|
|
46
|
-
|
|
47
|
-
Topic search terms are transmitted verbatim in Datatracker URLs and may appear in upstream logs; never derive hidden terms or send the full question as a search term unless the user explicitly chose it.
|
|
48
|
-
|
|
49
|
-
Preserve research status exactly: answered, partial, unsupported, needs_review, or needs_split. Accepted evidence may support an answer. A review candidate is canonical but unaccepted and must be quoted only as qualified review material. Keep requested and current RFC contexts distinct and never silently substitute a successor.
|
|
50
|
-
|
|
51
|
-
Exact reproduction of accepted evidence needs no citation call. Verify at most two paraphrased claims once each with verify_citation, using the exact returned quote and its UTF-8 byte offset. If a direct verification verdict is fabricated, use at most one research call to locate current wording and one verification call for that replacement. Never guess wording or offsets. Unsupported, contradicted, or fabricated verdicts cannot support an unqualified claim.
|
|
52
|
-
|
|
53
|
-
Operational tool errors are not research statuses. Preserve their typed error code and stop rather than substituting stale text, another provider, or memory. If a tool error reports a missing credential, ask the human operator to run rfc auth add; never request or accept the secret through MCP. A usage-accounting warning follows a successful paid operation and must not trigger a retry.
|
|
54
|
-
|
|
55
|
-
Do not read the agent-workflow resource for ordinary research. Read ${rfcMcpAgentReferenceUri} only when handling a non-answer status, operational failure, citation-repair workflow, or a provenance, privacy, cost, or cache question.`;
|
|
34
|
+
export { rfcAgentToolMetadata, rfcMcpAgentReferenceUri, rfcMcpInstructions } from "./agent-surface";
|
|
56
35
|
|
|
57
36
|
/**
|
|
58
37
|
* Complete Markdown reference exposed as a static MCP resource.
|
|
@@ -65,39 +44,39 @@ This MCP server is the complete RFC research backend. It owns live RFC discovery
|
|
|
65
44
|
|
|
66
45
|
For one atomic question:
|
|
67
46
|
|
|
68
|
-
1. Call \`
|
|
47
|
+
1. Call \`rfc_research_known_rfc\` when the RFC is known, otherwise call \`rfc_research_topic\` with one to four deliberate ordered technical search terms.
|
|
69
48
|
2. Make at most one targeted follow-up research call, and only when the first result has neither usable accepted evidence nor a review candidate. Never loop by rephrasing a valid result to chase \`answered\` or higher confidence.
|
|
70
49
|
3. When accepted evidence or a review candidate is returned, answer from that result and stop. Quote accepted evidence unchanged with provenance. Quote a review candidate only as explicitly unaccepted or \`needs_review\`.
|
|
71
|
-
4. Never call \`
|
|
50
|
+
4. Never call \`rfc_verify_citation\` after research to re-check returned evidence, normalize formatting, or obtain alternate provenance. Use it only for a user-supplied quotation or an explicitly requested distinct paraphrase check, at most twice.
|
|
72
51
|
5. Stop after the budget. Preserve non-answer statuses and typed operational failures.
|
|
73
52
|
|
|
74
53
|
For up to two explicit independently answerable questions, use one research call per question and keep their inputs and outputs separate. Do not invent a split for an ambiguous request; preserve \`needs_split\`.
|
|
75
54
|
|
|
76
55
|
## Tools
|
|
77
56
|
|
|
78
|
-
###
|
|
57
|
+
### rfc_research_known_rfc
|
|
79
58
|
|
|
80
59
|
Research one atomic question against a known published RFC. The server performs bounded live metadata lookup and currency traversal, researches requested and applicable current RFC contexts independently, and never silently substitutes a successor.
|
|
81
60
|
|
|
82
61
|
Inputs are \`question\` and \`rfc\`. Use the exact RFC identifier, such as \`RFC9110\`.
|
|
83
62
|
|
|
84
|
-
###
|
|
63
|
+
### rfc_research_topic
|
|
85
64
|
|
|
86
65
|
Discover and research published RFCs for one atomic topic question. Inputs are \`question\` and \`searchTerms\`. Supply one to four ordered non-empty terms, each no longer than ${datatrackerTopicSearchTermMaximumCharacters} characters. Terms are transmitted verbatim in Datatracker query URLs and may appear in diagnostics, errors, and upstream access logs. Do not generate hidden terms, rewrite the caller's phrases, or send the natural-language question upstream unless it was explicitly chosen as a term.
|
|
87
66
|
|
|
88
|
-
###
|
|
67
|
+
### rfc_verify_citation
|
|
89
68
|
|
|
90
69
|
Verify one factual claim against one exact RFC quotation. Inputs are \`rfc\`, \`claim\`, \`quote\`, and optional \`offset\`. The offset is an absolute UTF-8 byte offset into the exact source identified by \`sourceHash\`, not a JavaScript string index. Copy it from research provenance or omit it for a unique quotation. Never guess wording or offsets.
|
|
91
70
|
|
|
92
|
-
###
|
|
71
|
+
### rfc_source_cache_status
|
|
93
72
|
|
|
94
73
|
Inspect one named RFC source-cache entry without network access.
|
|
95
74
|
|
|
96
|
-
###
|
|
75
|
+
### rfc_source_cache_remove
|
|
97
76
|
|
|
98
77
|
Remove one named RFC source-cache entry without network access. This destructive, idempotent tool requires \`confirm: true\`. There is no list-all, refresh-all, prefetch, bulk download, or bulk clear operation.
|
|
99
78
|
|
|
100
|
-
###
|
|
79
|
+
### rfc_auth_status
|
|
101
80
|
|
|
102
81
|
Report only whether the stable TypeSafe credential identity is configured. The MCP never accepts, returns, adds, or removes credentials. If missing, ask the human operator to run \`rfc auth add\` outside MCP.
|
|
103
82
|
|
|
@@ -276,19 +255,13 @@ export const createRfcMcpServer = (
|
|
|
276
255
|
);
|
|
277
256
|
|
|
278
257
|
server.registerTool(
|
|
279
|
-
|
|
258
|
+
rfcAgentToolMetadata.researchKnownRfc.name,
|
|
280
259
|
{
|
|
281
|
-
title:
|
|
282
|
-
description:
|
|
283
|
-
"Inputs: question, rfc. Research one atomic question against a known published RFC. If evidence or a review candidate is returned, answer from it without a verification call. Includes bounded RFC currency traversal, provenance, status, and diagnostics.",
|
|
260
|
+
title: rfcAgentToolMetadata.researchKnownRfc.title,
|
|
261
|
+
description: rfcAgentToolMetadata.researchKnownRfc.description,
|
|
284
262
|
inputSchema: toMcpSchema(KnownRfcResearchInputSchema),
|
|
285
263
|
outputSchema: toMcpSchema(EvidenceBundleSchema),
|
|
286
|
-
annotations:
|
|
287
|
-
readOnlyHint: false,
|
|
288
|
-
destructiveHint: false,
|
|
289
|
-
idempotentHint: false,
|
|
290
|
-
openWorldHint: true,
|
|
291
|
-
},
|
|
264
|
+
annotations: rfcAgentToolMetadata.researchKnownRfc.annotations,
|
|
292
265
|
},
|
|
293
266
|
async ({ question, rfc }) => {
|
|
294
267
|
try {
|
|
@@ -303,19 +276,13 @@ export const createRfcMcpServer = (
|
|
|
303
276
|
);
|
|
304
277
|
|
|
305
278
|
server.registerTool(
|
|
306
|
-
|
|
279
|
+
rfcAgentToolMetadata.researchTopic.name,
|
|
307
280
|
{
|
|
308
|
-
title:
|
|
309
|
-
description:
|
|
310
|
-
"Inputs: question, searchTerms (1-4). Research one atomic topic question. If evidence or a review candidate is returned, answer from it without a verification call. Terms are sent verbatim to Datatracker; results include provenance, status, and diagnostics.",
|
|
281
|
+
title: rfcAgentToolMetadata.researchTopic.title,
|
|
282
|
+
description: rfcAgentToolMetadata.researchTopic.description,
|
|
311
283
|
inputSchema: toMcpSchema(TopicResearchInputSchema),
|
|
312
284
|
outputSchema: toMcpSchema(EvidenceBundleSchema),
|
|
313
|
-
annotations:
|
|
314
|
-
readOnlyHint: false,
|
|
315
|
-
destructiveHint: false,
|
|
316
|
-
idempotentHint: false,
|
|
317
|
-
openWorldHint: true,
|
|
318
|
-
},
|
|
285
|
+
annotations: rfcAgentToolMetadata.researchTopic.annotations,
|
|
319
286
|
},
|
|
320
287
|
async ({ question, searchTerms }) => {
|
|
321
288
|
try {
|
|
@@ -334,19 +301,13 @@ export const createRfcMcpServer = (
|
|
|
334
301
|
);
|
|
335
302
|
|
|
336
303
|
server.registerTool(
|
|
337
|
-
|
|
304
|
+
rfcAgentToolMetadata.verifyCitation.name,
|
|
338
305
|
{
|
|
339
|
-
title:
|
|
340
|
-
description:
|
|
341
|
-
"Inputs: rfc, claim, quote; optional offset. Check one factual claim against one exact RFC quotation. Returns a verified, unsupported, contradicted, or fabricated verdict with canonical provenance.",
|
|
306
|
+
title: rfcAgentToolMetadata.verifyCitation.title,
|
|
307
|
+
description: rfcAgentToolMetadata.verifyCitation.description,
|
|
342
308
|
inputSchema: toMcpSchema(CitationInputSchema),
|
|
343
309
|
outputSchema: toMcpSchema(CitationVerificationResultSchema),
|
|
344
|
-
annotations:
|
|
345
|
-
readOnlyHint: false,
|
|
346
|
-
destructiveHint: false,
|
|
347
|
-
idempotentHint: false,
|
|
348
|
-
openWorldHint: true,
|
|
349
|
-
},
|
|
310
|
+
annotations: rfcAgentToolMetadata.verifyCitation.annotations,
|
|
350
311
|
},
|
|
351
312
|
async ({ rfc, claim, quote, offset }) => {
|
|
352
313
|
try {
|
|
@@ -365,19 +326,13 @@ export const createRfcMcpServer = (
|
|
|
365
326
|
);
|
|
366
327
|
|
|
367
328
|
server.registerTool(
|
|
368
|
-
|
|
329
|
+
rfcAgentToolMetadata.sourceCacheStatus.name,
|
|
369
330
|
{
|
|
370
|
-
title:
|
|
371
|
-
description:
|
|
372
|
-
"Input: rfc. Inspect one named canonical RFC source-cache entry locally without network access.",
|
|
331
|
+
title: rfcAgentToolMetadata.sourceCacheStatus.title,
|
|
332
|
+
description: rfcAgentToolMetadata.sourceCacheStatus.description,
|
|
373
333
|
inputSchema: toMcpSchema(RfcInputSchema),
|
|
374
334
|
outputSchema: toMcpSchema(RfcSourceCacheStatusSchema),
|
|
375
|
-
annotations:
|
|
376
|
-
readOnlyHint: true,
|
|
377
|
-
destructiveHint: false,
|
|
378
|
-
idempotentHint: true,
|
|
379
|
-
openWorldHint: false,
|
|
380
|
-
},
|
|
335
|
+
annotations: rfcAgentToolMetadata.sourceCacheStatus.annotations,
|
|
381
336
|
},
|
|
382
337
|
async ({ rfc }) => {
|
|
383
338
|
try {
|
|
@@ -392,19 +347,13 @@ export const createRfcMcpServer = (
|
|
|
392
347
|
);
|
|
393
348
|
|
|
394
349
|
server.registerTool(
|
|
395
|
-
|
|
350
|
+
rfcAgentToolMetadata.sourceCacheRemove.name,
|
|
396
351
|
{
|
|
397
|
-
title:
|
|
398
|
-
description:
|
|
399
|
-
"Inputs: rfc, confirm=true. Remove one named canonical RFC source-cache entry locally without network access; never performs bulk removal.",
|
|
352
|
+
title: rfcAgentToolMetadata.sourceCacheRemove.title,
|
|
353
|
+
description: rfcAgentToolMetadata.sourceCacheRemove.description,
|
|
400
354
|
inputSchema: toMcpSchema(SourceCacheRemoveInputSchema),
|
|
401
355
|
outputSchema: toMcpSchema(RfcSourceCacheRemoveResultSchema),
|
|
402
|
-
annotations:
|
|
403
|
-
readOnlyHint: false,
|
|
404
|
-
destructiveHint: true,
|
|
405
|
-
idempotentHint: true,
|
|
406
|
-
openWorldHint: false,
|
|
407
|
-
},
|
|
356
|
+
annotations: rfcAgentToolMetadata.sourceCacheRemove.annotations,
|
|
408
357
|
},
|
|
409
358
|
async ({ rfc, confirm }) => {
|
|
410
359
|
try {
|
|
@@ -427,19 +376,13 @@ export const createRfcMcpServer = (
|
|
|
427
376
|
);
|
|
428
377
|
|
|
429
378
|
server.registerTool(
|
|
430
|
-
|
|
379
|
+
rfcAgentToolMetadata.authStatus.name,
|
|
431
380
|
{
|
|
432
|
-
title:
|
|
433
|
-
description:
|
|
434
|
-
"No inputs. Report only whether the stable TypeSafe credential identity is configured. Never returns, accepts, adds, or removes the credential.",
|
|
381
|
+
title: rfcAgentToolMetadata.authStatus.title,
|
|
382
|
+
description: rfcAgentToolMetadata.authStatus.description,
|
|
435
383
|
inputSchema: toMcpSchema(EmptyInputSchema),
|
|
436
384
|
outputSchema: toMcpSchema(AuthStatusSchema),
|
|
437
|
-
annotations:
|
|
438
|
-
readOnlyHint: true,
|
|
439
|
-
destructiveHint: false,
|
|
440
|
-
idempotentHint: true,
|
|
441
|
-
openWorldHint: false,
|
|
442
|
-
},
|
|
385
|
+
annotations: rfcAgentToolMetadata.authStatus.annotations,
|
|
443
386
|
},
|
|
444
387
|
async () => {
|
|
445
388
|
try {
|