explain_artifact
Parse and display the format and top-level contents of a signed artifact from a JSON string or file, without needing a verification key.
Instructions
Explain the format and top-level contents of a signed artifact without requiring a verification key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| artifact_json | No | Raw JSON artifact string. | |
| path | No | Path to a local JSON artifact file. |
Implementation Reference
- server.js:132-147 (handler)The core handler function `explainArtifact` that extracts and returns the type, format, issuer, kid, issued_at, and payload_keys from an artifact without requiring a verification key.
function explainArtifact(artifact) { const core = getArtifactCore(artifact); const payload = artifact?.payload || core.artifact?.payload || core.artifact; const payloadKeys = payload && typeof payload === 'object' ? Object.keys(payload).filter((k) => k !== 'signature').sort() : []; return { type: artifact?.type || core.artifact?.type || 'unknown', format: core.format, issuer: artifact?.issuer || null, kid: core.kid, issued_at: artifact?.issued_at || artifact?.timestamp || payload?.issued_at || null, payload_keys: payloadKeys, }; } - server.js:231-234 (schema)Zod schema definitions for the explain_artifact tool: artifact_json (optional string) and path (optional string), both described for raw JSON or file path input.
{ artifact_json: z.string().optional().describe('Raw JSON artifact string.'), path: z.string().optional().describe('Path to a local JSON artifact file.'), }, - server.js:228-243 (registration)Registration of the 'explain_artifact' tool on the McpServer using server.tool(), with a description and async handler that reads input and calls explainArtifact().
server.tool( 'explain_artifact', 'Explain the format and top-level contents of a signed artifact without requiring a verification key.', { artifact_json: z.string().optional().describe('Raw JSON artifact string.'), path: z.string().optional().describe('Path to a local JSON artifact file.'), }, async (args) => { try { const artifact = readJsonInput(args.path, args.artifact_json); return textResult(explainArtifact(artifact)); } catch (error) { return textResult({ ok: false, error: error.message }); } } );