Skip to main content
Glama
mjpitz
by mjpitz

get_rfc

Fetch RFC documents by number to access technical specifications and standards, supporting full text, metadata, or specific sections.

Instructions

Fetch an RFC document by its number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numberYesRFC number (e.g. "2616")
formatNoOutput format (full, metadata, sections)full

Implementation Reference

  • The MCP tool handler for 'get_rfc' in the CallToolRequestSchema. Validates input, fetches RFC via service, formats output (full/metadata/sections), returns JSON text or error.
    case 'get_rfc': { if (typeof typedArgs.number !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'RFC number must be a string' ); } try { const rfc = await rfcService.fetchRfc(typedArgs.number); // Format the output based on the requested format const format = typedArgs.format || 'full'; let result; switch (format) { case 'metadata': result = rfc.metadata; break; case 'sections': result = rfc.sections; break; case 'full': default: result = rfc; break; } return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching RFC ${typedArgs.number}: ${error}`, }, ], isError: true, }; } }
  • src/index.ts:126-146 (registration)
    Tool registration in ListToolsRequestSchema, defining name, description, and input schema for 'get_rfc'.
    { name: 'get_rfc', description: 'Fetch an RFC document by its number', inputSchema: { type: 'object', properties: { number: { type: 'string', description: 'RFC number (e.g. "2616")', }, format: { type: 'string', description: 'Output format (full, metadata, sections)', enum: ['full', 'metadata', 'sections'], default: 'full', }, }, required: ['number'], additionalProperties: false, }, },
  • Input schema definition for the 'get_rfc' tool, specifying parameters 'number' (required) and optional 'format'.
    inputSchema: { type: 'object', properties: { number: { type: 'string', description: 'RFC number (e.g. "2616")', }, format: { type: 'string', description: 'Output format (full, metadata, sections)', enum: ['full', 'metadata', 'sections'], default: 'full', }, }, required: ['number'], additionalProperties: false,
  • Core helper function fetchRfc that retrieves RFC content from IETF URLs (HTML preferred, TXT fallback), parses structure, caches result, returns RfcContent object.
    async fetchRfc(rfcNumber: string): Promise<RfcContent> { // Check cache first if (this.cache.has(rfcNumber)) { return this.cache.get(rfcNumber)!; } // Fetch the RFC in both HTML and TXT formats const txtUrl = `${this.baseUrl}/rfc${rfcNumber}.txt`; const htmlUrl = `${this.baseUrl}/rfc${rfcNumber}/`; try { // Try HTML first for better structure const htmlResponse = await axios.get(htmlUrl); const rfc = this.parseHtmlRfc(htmlResponse.data, rfcNumber, htmlUrl); this.cache.set(rfcNumber, rfc); return rfc; } catch (error) { try { // Fallback to TXT format console.error(`Failed to fetch HTML format for RFC ${rfcNumber}, trying TXT format`); const txtResponse = await axios.get(txtUrl); const rfc = this.parseTxtRfc(txtResponse.data, rfcNumber, txtUrl); this.cache.set(rfcNumber, rfc); return rfc; } catch (txtError) { throw new Error(`Failed to fetch RFC ${rfcNumber}: ${txtError}`); } } }

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mjpitz/mcp-rfc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server