@wyattjoh/rfc 0.1.0 → 0.2.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.
- 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 +137 -52
- 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.
|
|
3
|
+
"version": "0.2.0",
|
|
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,7 @@ 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
12
|
import { runRfcMcpServer } from "./mcp";
|
|
13
13
|
import {
|
|
14
14
|
executeAuthStatus,
|
|
@@ -86,8 +86,10 @@ export interface RfcCliDependencies {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const format = Flag.Literals("format", ["json", "human"] as const).pipe(
|
|
89
|
-
Flag.withDescription(
|
|
90
|
-
|
|
89
|
+
Flag.withDescription(
|
|
90
|
+
"Output format; defaults to human for arguments and JSON for structured standard input",
|
|
91
|
+
),
|
|
92
|
+
Flag.optional,
|
|
91
93
|
);
|
|
92
94
|
|
|
93
95
|
const cacheDirectory = Flag.String("cache-directory").pipe(
|
|
@@ -101,16 +103,32 @@ const datatrackerApiUrl = Flag.String("datatracker-api-url").pipe(
|
|
|
101
103
|
);
|
|
102
104
|
|
|
103
105
|
const question = Flag.String("question").pipe(
|
|
106
|
+
Flag.withAlias("q"),
|
|
104
107
|
Flag.withDescription("Short question used when standard input is not supplied"),
|
|
105
108
|
Flag.optional,
|
|
106
109
|
);
|
|
107
110
|
|
|
111
|
+
const questionArgument = Argument.String("question").pipe(
|
|
112
|
+
Argument.withDescription("Question to research when standard input is not supplied"),
|
|
113
|
+
Argument.optional,
|
|
114
|
+
);
|
|
115
|
+
|
|
108
116
|
const rfc = Flag.String("rfc").pipe(
|
|
117
|
+
Flag.withAlias("r"),
|
|
109
118
|
Flag.withDescription("Known RFC identifier for a short interactive request"),
|
|
110
119
|
Flag.optional,
|
|
111
120
|
);
|
|
112
121
|
|
|
113
|
-
const cacheRfc = Flag.String("rfc").pipe(
|
|
122
|
+
const cacheRfc = Flag.String("rfc").pipe(
|
|
123
|
+
Flag.withAlias("r"),
|
|
124
|
+
Flag.withDescription("Named RFC source cache entry"),
|
|
125
|
+
Flag.optional,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const rfcArgument = Argument.String("rfc").pipe(
|
|
129
|
+
Argument.withDescription("Named RFC identifier"),
|
|
130
|
+
Argument.optional,
|
|
131
|
+
);
|
|
114
132
|
|
|
115
133
|
const searchTerms = Flag.String("search-term").pipe(
|
|
116
134
|
Flag.withDescription("Ordered topic-discovery term; repeat one to four times"),
|
|
@@ -127,11 +145,21 @@ const claim = Flag.String("claim").pipe(
|
|
|
127
145
|
Flag.optional,
|
|
128
146
|
);
|
|
129
147
|
|
|
148
|
+
const claimArgument = Argument.String("claim").pipe(
|
|
149
|
+
Argument.withDescription("Factual claim to verify when standard input is not supplied"),
|
|
150
|
+
Argument.optional,
|
|
151
|
+
);
|
|
152
|
+
|
|
130
153
|
const quote = Flag.String("quote").pipe(
|
|
131
154
|
Flag.withDescription("Exact RFC quotation to verify when standard input is not supplied"),
|
|
132
155
|
Flag.optional,
|
|
133
156
|
);
|
|
134
157
|
|
|
158
|
+
const quoteArgument = Argument.String("quote").pipe(
|
|
159
|
+
Argument.withDescription("Exact RFC quotation to verify when standard input is not supplied"),
|
|
160
|
+
Argument.optional,
|
|
161
|
+
);
|
|
162
|
+
|
|
135
163
|
const offset = Flag.String("offset").pipe(
|
|
136
164
|
Flag.withDescription("Absolute UTF-8 byte offset for a repeated quotation"),
|
|
137
165
|
Flag.optional,
|
|
@@ -314,6 +342,37 @@ const parseCitationOffset = (value: string): number => {
|
|
|
314
342
|
return parsed;
|
|
315
343
|
};
|
|
316
344
|
|
|
345
|
+
const resolveArgumentInput = (
|
|
346
|
+
flagName: string,
|
|
347
|
+
flagValue: Option.Option<string>,
|
|
348
|
+
argumentValue: Option.Option<string>,
|
|
349
|
+
): string | undefined => {
|
|
350
|
+
if (Option.isSome(flagValue) && Option.isSome(argumentValue)) {
|
|
351
|
+
throw new InvalidInputError({
|
|
352
|
+
reason: `${flagName} cannot be combined with its positional argument`,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return Option.getOrUndefined(flagValue) ?? Option.getOrUndefined(argumentValue);
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const resolveRequiredArgumentInput = (
|
|
359
|
+
flagName: string,
|
|
360
|
+
flagValue: Option.Option<string>,
|
|
361
|
+
argumentValue: Option.Option<string>,
|
|
362
|
+
): string => {
|
|
363
|
+
const value = resolveArgumentInput(flagName, flagValue, argumentValue);
|
|
364
|
+
if (value === undefined) {
|
|
365
|
+
throw new InvalidInputError({ reason: `${flagName} or its positional argument is required` });
|
|
366
|
+
}
|
|
367
|
+
return value;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const resolveOutputFormat = (
|
|
371
|
+
selected: Option.Option<"json" | "human">,
|
|
372
|
+
structuredStandardInput = false,
|
|
373
|
+
): "json" | "human" =>
|
|
374
|
+
Option.getOrElse(selected, () => (structuredStandardInput ? "json" : "human"));
|
|
375
|
+
|
|
317
376
|
const renderUsageTotals = (totals: UsageTotals): string =>
|
|
318
377
|
[
|
|
319
378
|
`Updated: ${totals.updatedAt}`,
|
|
@@ -360,19 +419,23 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
360
419
|
cacheDirectory,
|
|
361
420
|
format,
|
|
362
421
|
rfc: cacheRfc,
|
|
422
|
+
rfcArgument,
|
|
363
423
|
},
|
|
364
|
-
Effect.fn(function* ({ cacheDirectory, format, rfc }) {
|
|
424
|
+
Effect.fn(function* ({ cacheDirectory, format, rfc, rfcArgument }) {
|
|
425
|
+
const selectedRfc = resolveRequiredArgumentInput("--rfc", rfc, rfcArgument);
|
|
365
426
|
const status = yield* Effect.tryPromise({
|
|
366
427
|
try: () =>
|
|
367
428
|
executeSourceCacheStatus(
|
|
368
|
-
|
|
429
|
+
selectedRfc,
|
|
369
430
|
operationOptions(cacheDirectory, Option.none(), Option.none()),
|
|
370
431
|
dependencies,
|
|
371
432
|
),
|
|
372
433
|
catch: (error) => error,
|
|
373
434
|
});
|
|
374
435
|
yield* writeStdout(
|
|
375
|
-
format === "human"
|
|
436
|
+
resolveOutputFormat(format) === "human"
|
|
437
|
+
? renderSourceCacheStatus(status)
|
|
438
|
+
: JSON.stringify(status),
|
|
376
439
|
);
|
|
377
440
|
}),
|
|
378
441
|
).pipe(Command.withDescription("Inspect one RFC source cache entry without network access"));
|
|
@@ -383,19 +446,23 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
383
446
|
cacheDirectory,
|
|
384
447
|
format,
|
|
385
448
|
rfc: cacheRfc,
|
|
449
|
+
rfcArgument,
|
|
386
450
|
},
|
|
387
|
-
Effect.fn(function* ({ cacheDirectory, format, rfc }) {
|
|
451
|
+
Effect.fn(function* ({ cacheDirectory, format, rfc, rfcArgument }) {
|
|
452
|
+
const selectedRfc = resolveRequiredArgumentInput("--rfc", rfc, rfcArgument);
|
|
388
453
|
const result = yield* Effect.tryPromise({
|
|
389
454
|
try: () =>
|
|
390
455
|
executeSourceCacheRemove(
|
|
391
|
-
|
|
456
|
+
selectedRfc,
|
|
392
457
|
operationOptions(cacheDirectory, Option.none(), Option.none()),
|
|
393
458
|
dependencies,
|
|
394
459
|
),
|
|
395
460
|
catch: (error) => error,
|
|
396
461
|
});
|
|
397
462
|
yield* writeStdout(
|
|
398
|
-
format === "human"
|
|
463
|
+
resolveOutputFormat(format) === "human"
|
|
464
|
+
? renderSourceCacheRemove(result)
|
|
465
|
+
: JSON.stringify(result),
|
|
399
466
|
);
|
|
400
467
|
}),
|
|
401
468
|
).pipe(Command.withDescription("Remove one RFC source cache entry without network access"));
|
|
@@ -412,8 +479,11 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
412
479
|
datatrackerApiUrl,
|
|
413
480
|
format,
|
|
414
481
|
rfc,
|
|
482
|
+
rfcArgument,
|
|
415
483
|
claim,
|
|
484
|
+
claimArgument,
|
|
416
485
|
quote,
|
|
486
|
+
quoteArgument,
|
|
417
487
|
offset,
|
|
418
488
|
typeSafeApiUrl,
|
|
419
489
|
},
|
|
@@ -427,21 +497,26 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
427
497
|
standardInput.trim().length > 0
|
|
428
498
|
? decodeCitationInput(standardInput)
|
|
429
499
|
: (() => {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
500
|
+
const selectedRfc = resolveRequiredArgumentInput(
|
|
501
|
+
"--rfc",
|
|
502
|
+
flags.rfc,
|
|
503
|
+
flags.rfcArgument,
|
|
504
|
+
);
|
|
505
|
+
const selectedClaim = resolveRequiredArgumentInput(
|
|
506
|
+
"--claim",
|
|
507
|
+
flags.claim,
|
|
508
|
+
flags.claimArgument,
|
|
509
|
+
);
|
|
510
|
+
const selectedQuote = resolveRequiredArgumentInput(
|
|
511
|
+
"--quote",
|
|
512
|
+
flags.quote,
|
|
513
|
+
flags.quoteArgument,
|
|
514
|
+
);
|
|
440
515
|
return decodeCitationRequest({
|
|
441
516
|
schemaVersion: 2,
|
|
442
|
-
rfc:
|
|
443
|
-
claim:
|
|
444
|
-
quote:
|
|
517
|
+
rfc: selectedRfc,
|
|
518
|
+
claim: selectedClaim,
|
|
519
|
+
quote: selectedQuote,
|
|
445
520
|
offset: Option.isSome(flags.offset)
|
|
446
521
|
? parseCitationOffset(flags.offset.value)
|
|
447
522
|
: null,
|
|
@@ -459,7 +534,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
459
534
|
});
|
|
460
535
|
yield* writeWarnings(result.warnings);
|
|
461
536
|
yield* writeStdout(
|
|
462
|
-
flags.format === "human"
|
|
537
|
+
resolveOutputFormat(flags.format, standardInput.trim().length > 0) === "human"
|
|
463
538
|
? renderCitationVerification(result.value)
|
|
464
539
|
: JSON.stringify(result.value),
|
|
465
540
|
);
|
|
@@ -473,8 +548,8 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
473
548
|
},
|
|
474
549
|
{
|
|
475
550
|
command:
|
|
476
|
-
'rfc verify-citation
|
|
477
|
-
description: "Verify a short interactive citation",
|
|
551
|
+
'rfc verify-citation RFC9110 "The client sends a request" "The client MUST send a request"',
|
|
552
|
+
description: "Verify a short interactive citation with positional arguments",
|
|
478
553
|
},
|
|
479
554
|
]),
|
|
480
555
|
);
|
|
@@ -486,7 +561,9 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
486
561
|
datatrackerApiUrl,
|
|
487
562
|
format,
|
|
488
563
|
question,
|
|
564
|
+
questionArgument,
|
|
489
565
|
rfc,
|
|
566
|
+
rfcArgument,
|
|
490
567
|
searchTerms,
|
|
491
568
|
typeSafeApiUrl,
|
|
492
569
|
},
|
|
@@ -499,25 +576,27 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
499
576
|
const request =
|
|
500
577
|
standardInput.trim().length > 0
|
|
501
578
|
? decodeResearchInput(standardInput)
|
|
502
|
-
:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
579
|
+
: (() => {
|
|
580
|
+
const selectedQuestion = resolveRequiredArgumentInput(
|
|
581
|
+
"--question",
|
|
582
|
+
flags.question,
|
|
583
|
+
flags.questionArgument,
|
|
584
|
+
);
|
|
585
|
+
const selectedRfc = resolveArgumentInput("--rfc", flags.rfc, flags.rfcArgument);
|
|
586
|
+
return selectedRfc === undefined
|
|
587
|
+
? decodeResearchRequest({
|
|
588
|
+
schemaVersion,
|
|
589
|
+
question: selectedQuestion,
|
|
590
|
+
rfc: null,
|
|
591
|
+
searchTerms: flags.searchTerms,
|
|
592
|
+
})
|
|
593
|
+
: decodeResearchRequest({
|
|
594
|
+
schemaVersion,
|
|
595
|
+
question: selectedQuestion,
|
|
596
|
+
rfc: selectedRfc,
|
|
597
|
+
searchTerms: flags.searchTerms.length === 0 ? undefined : flags.searchTerms,
|
|
598
|
+
});
|
|
599
|
+
})();
|
|
521
600
|
|
|
522
601
|
const result = yield* Effect.tryPromise({
|
|
523
602
|
try: () =>
|
|
@@ -530,7 +609,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
530
609
|
});
|
|
531
610
|
yield* writeWarnings(result.warnings);
|
|
532
611
|
yield* writeStdout(
|
|
533
|
-
flags.format === "human"
|
|
612
|
+
resolveOutputFormat(flags.format, standardInput.trim().length > 0) === "human"
|
|
534
613
|
? renderEvidenceBundle(result.value)
|
|
535
614
|
: JSON.stringify(result.value),
|
|
536
615
|
);
|
|
@@ -543,8 +622,8 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
543
622
|
description: "Use canonical JSON from standard input",
|
|
544
623
|
},
|
|
545
624
|
{
|
|
546
|
-
command: 'rfc research
|
|
547
|
-
description: "Use
|
|
625
|
+
command: 'rfc research "What does RFC 9110 require?" RFC9110',
|
|
626
|
+
description: "Use human-friendly positional arguments when standard input is empty",
|
|
548
627
|
},
|
|
549
628
|
]),
|
|
550
629
|
);
|
|
@@ -566,7 +645,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
566
645
|
catch: (error) => error,
|
|
567
646
|
});
|
|
568
647
|
|
|
569
|
-
if (format === "human") {
|
|
648
|
+
if (resolveOutputFormat(format) === "human") {
|
|
570
649
|
yield* writeStdout(
|
|
571
650
|
result.replaced
|
|
572
651
|
? "TypeSafe API key replaced in the platform credential store"
|
|
@@ -589,7 +668,9 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
589
668
|
try: () => executeAuthStatus(dependencies),
|
|
590
669
|
catch: (error) => error,
|
|
591
670
|
});
|
|
592
|
-
yield* writeStdout(
|
|
671
|
+
yield* writeStdout(
|
|
672
|
+
resolveOutputFormat(format) === "human" ? renderAuthStatus(result) : JSON.stringify(result),
|
|
673
|
+
);
|
|
593
674
|
}),
|
|
594
675
|
).pipe(Command.withDescription("Inspect TypeSafe credential configuration without revealing it"));
|
|
595
676
|
|
|
@@ -601,7 +682,7 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
601
682
|
try: () => removeStoredCredential(dependencies.credentialStore),
|
|
602
683
|
catch: (error) => error,
|
|
603
684
|
});
|
|
604
|
-
if (format === "human") {
|
|
685
|
+
if (resolveOutputFormat(format) === "human") {
|
|
605
686
|
yield* writeStdout(
|
|
606
687
|
result.removed
|
|
607
688
|
? "TypeSafe API key removed from the platform credential store"
|
|
@@ -628,7 +709,11 @@ const makeApplication = (dependencies: RfcCliDependencies) => {
|
|
|
628
709
|
try: dependencies.readUsage,
|
|
629
710
|
catch: (error) => error,
|
|
630
711
|
});
|
|
631
|
-
yield* writeStdout(
|
|
712
|
+
yield* writeStdout(
|
|
713
|
+
resolveOutputFormat(format) === "human"
|
|
714
|
+
? renderUsageTotals(totals)
|
|
715
|
+
: JSON.stringify(totals),
|
|
716
|
+
);
|
|
632
717
|
}),
|
|
633
718
|
).pipe(Command.withDescription("Print cumulative per-user RFC usage costs"));
|
|
634
719
|
|
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 {
|