CodeSampleX

MCP

Funktionen

Acht öffentliche MCP-Werkzeuge lassen deinen Coding-Agenten verifizierte Antworten wiederverwenden, echte Builds beobachten und die nächste Antwort verbessern.

Diese Seite dokumentiert die vollständige öffentliche MCP-Oberfläche. Ein MCP-Werkzeug zum Veröffentlichen von Samples gibt es bewusst nicht.

Find and inspect evidence

Search for a verified answer, fetch its files, or inspect compatibility evidence for one public software target and symbol.

search_known_solution Find a verified solution graded against the environment you describe.

Funktion

Searches the local CodeSampleX network cache. A hit reports its match grade, environment differences, adaptations, evidence counts, and the contract assertions that actually passed. A miss is returned as NO_SAFE_MATCH, never guessed into a hit.

Wann verwenden

Call before using a public library, SDK, runtime, OS command or standalone CLI, or when its error may already have a verified detour.

Eingaben

Erforderlich

query string
What you are trying to do or fix, in plain words.

Optional

packages string[]
Public target coordinates: pkg:npm/axios@1.12.0 for a registry package or pkg:generic/cli/npm@11.5.2 for the npm CLI itself.
symbols string[]
Public symbol families, for example axios.post.
environment object
Sparse environment fingerprint; known values may include ecosystem, OS, architecture, runtime, language, compiler, package manager, module system, frameworks, execution context, browser/engine, libc, virtualization, and container runtime.
errorText string
Raw error text to sanitize locally into an error code and fingerprint.

JSON-Eingabebeispiel

{
  "query": "send JSON and retry a reset connection",
  "packages": ["pkg:npm/axios@1.12.0"],
  "symbols": ["axios.post"],
  "environment": {"os":"linux","runtime":"node","runtimeVersion":"22.18","executionContext":"node"}
}

Ausgabeform und Beispiel

MCP content text plus structuredContent containing the search response and a local offerId on an eligible hit. A miss can also include packageOverview and localReady.

{
  "structuredContent": {
    "schemaVersion": 2,
    "results": [{"grade":"EXACT","sampleId":"sha256:..."}],
    "offerId": "local-offer-id"
  }
}
get_sample Fetch the manifest and readable files for one cached public sample.

Funktion

Returns the sample manifest and cached text files. Each file is capped at 64 KB and binary files are skipped. Public samples are MIT-0 community artifacts.

Wann verwenden

Use after search_known_solution returns a sampleId and you need the complete runnable example.

Eingaben

Erforderlich

sampleId string
Content-addressed sample id in sha256:... form.

Optional

Keine Felder.

JSON-Eingabebeispiel

{"sampleId":"sha256:0123456789abcdef..."}

Ausgabeform und Beispiel

MCP content text plus structuredContent with sampleId, manifest, and a path-to-content files object.

{
  "structuredContent": {
    "sampleId": "sha256:...",
    "manifest": {"license":"MIT-0","packages":["pkg:npm/axios@1.12.0"]},
    "files": {"src/index.mjs":"..."}
  }
}
explain_compatibility Explain cached compatibility evidence for a package and optional symbol.

Funktion

Reads local compatibility shards and keeps project observations separate from contract verification evidence instead of adding unlike evidence together.

Wann verwenden

Use when you need the per-symbol evidence behind a result or want to compare one package with a target environment.

Eingaben

Erforderlich

package string
Package purl, for example pkg:npm/axios@1.12.0.

Optional

symbol string
Public symbol family, for example axios.post.
environment object
The same sparse environment fingerprint accepted by search_known_solution.

JSON-Eingabebeispiel

{
  "package": "pkg:npm/axios@1.12.0",
  "symbol": "axios.post",
  "environment": {"runtime":"node","runtimeVersion":"22.18"}
}

Ausgabeform und Beispiel

MCP content text plus structuredContent with package, symbol, and the underlying compatibility snapshot (or null).

{
  "structuredContent": {
    "package": "pkg:npm/axios@1.12.0",
    "symbol": "axios.post",
    "snapshot": {"schemaVersion":1,"rows":[]}
  }
}

Run with observation

Execute a normal build or test while recording a sanitized public-package outcome.

run_observed_command Run an argv command through the evidence loop and return its real exit code.

Funktion

Scans public dependencies, runs the command locally, classifies its stage and result, and returns only sanitized error templates alongside the original exit code.

Wann verwenden

Use for builds and tests after adopting or creating package-dependent code, instead of running the command outside CodeSampleX.

Eingaben

Erforderlich

command string[]
Command argv, for example ["npm","test"].

Optional

cwd string
Working directory; defaults to the current directory.

JSON-Eingabebeispiel

{"command":["npm","test"],"cwd":"project"}

Ausgabeform und Beispiel

MCP content text plus structuredContent with exitCode, stage, result, sanitizedErrors, and evidenceClass.

{
  "structuredContent": {
    "exitCode": 0,
    "stage": "PROJECT_TEST",
    "result": "PASS",
    "sanitizedErrors": [],
    "evidenceClass": "USAGE_OBSERVATION"
  }
}

Close the evidence loop

Report whether an offered answer worked, or prepare a clean-room sample proposal after a miss.

report_sample_adoption Record whether a search result was applied and whether the next build passed.

Funktion

Correlates the report with the local offer returned by search_known_solution and records ADOPTION_EVIDENCE. A failure is counted as avoided only when the full local correlation proves it.

Wann verwenden

Call after deciding whether to use an offered sample, once the post-adoption build result is known or explicitly unknown.

Eingaben

Erforderlich

offerId string
Opaque local offer id returned by search_known_solution.
sampleId string
The offered sha256 content address.
applied boolean
Whether the sample approach was applied.

Optional

buildPass boolean
Whether the project built or passed after adoption; omit when unknown.

JSON-Eingabebeispiel

{"offerId":"local-offer-id","sampleId":"sha256:...","applied":true,"buildPass":true}

Ausgabeform und Beispiel

MCP content text plus structuredContent with recorded, uploadQueued, sampleId, applied, reportedFailureAvoided, evidenceClass, and buildPass when supplied.

{
  "structuredContent": {
    "recorded": true,
    "uploadQueued": true,
    "sampleId": "sha256:...",
    "applied": true,
    "buildPass": true,
    "reportedFailureAvoided": false,
    "evidenceClass": "ADOPTION_EVIDENCE"
  }
}
propose_public_sample Create a sanitized clean-room brief and an empty local workspace.

Funktion

Builds a proposal from a goal, public package purls, and public symbols, then returns generation instructions and the exact empty workspace path. This tool cannot publish.

Wann verwenden

Use after NO_SAFE_MATCH when you solved the boundary and the observed build or contract passed.

Eingaben

Erforderlich

goal string
The behavior the sample should prove.
packages string[]
Public package purls the sample must use.

Optional

symbols string[]
Public symbol families the sample should demonstrate.

JSON-Eingabebeispiel

{"goal":"axios upload progress","packages":["pkg:npm/axios@1.12.0"],"symbols":["axios.post"]}

Ausgabeform und Beispiel

MCP content text plus structuredContent with spec, prompt, workdir, and publishRequiresUserApproval.

{
  "structuredContent": {
    "spec": {"goal":"axios upload progress","packages":["pkg:npm/axios@1.12.0"]},
    "prompt": "Generate the sample...",
    "workdir": "<local clean-room path>",
    "publishRequiresUserApproval": true
  }
}

Inspect this installation

Read recent local search outcomes or the local dashboard counters without uploading anything.

list_local_hits List recent search hits, grades, and adoption outcomes stored locally.

Funktion

Returns recent hit rows with timestamp, query, grade, sample id, adopted state, and post-build result when it was reported.

Wann verwenden

Use to audit which answers this installation received and whether they were later adopted.

Eingaben

Erforderlich

Keine Felder.

Optional

Keine Felder.

JSON-Eingabebeispiel

{}

Ausgabeform und Beispiel

MCP content text plus structuredContent with a hits array. postBuildPass is omitted when unknown.

{
  "structuredContent": {
    "hits": [{"ts":"2026-08-13T10:00:00Z","query":"axios post","grade":"COMPATIBLE","sampleId":"sha256:...","adopted":true,"postBuildPass":true}]
  }
}
get_local_stats Read mode, cache, queue, hit, and adoption counters for this installation.

Funktion

Returns the current local stats object. Common keys include mode, hits, cachedSamples, queuedUploads, pendingObservations, and the verified-detour outcome counters; the available set can grow.

Wann verwenden

Use to check initialization, cache readiness, pending community work, or whether the evidence loop is being used repeatedly.

Eingaben

Erforderlich

Keine Felder.

Optional

Keine Felder.

JSON-Eingabebeispiel

{}

Ausgabeform und Beispiel

MCP content text plus the local stats map directly as structuredContent.

{
  "structuredContent": {
    "mode": "community",
    "hits": 7,
    "cachedSamples": 31,
    "queuedUploads": 0,
    "pendingObservations": 0
  }
}