On this page

Context

fetch-code

Fetch one code span from the ingested codebase. Needs the fabric:query.read grant.

curl -sS -X POST https://fabric.wexa.ai/mcp/$FABRIC_PROJECT_ID \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "Mcp-Session-Id: $MCP_SESSION_ID" \
  -H "content-type: application/json" -H "accept: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"fetch-code","arguments":{"path":"src/main.go","start_line":1,"end_line":10}}}'
{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000166\",\"result\":{\"content\":\"\",\"note\":\"no CodeChunk matched; re-sync the repo after CodeChunk ingest shipped\",\"truncated\":false}}"
    }
  ],
  "isError": false
}

Parameters

ParameterTypeRequiredNotes
pathstringOptionalRepo-relative file path, from a search-code hit. Give path with start_line and end_line, or row_pk instead.
start_lineintegerOptional1-based start line (inclusive). Needed with path; positive.
end_lineintegerOptional1-based end line (inclusive). Needed with path; positive and not below start_line.
row_pkstringOptionalA CodeChunk row_pk from search-code. Replaces path and the line range.
Errors

A path or row_pk that matches nothing is not an error: the call succeeds with empty content and a note.

Show full response

A real response, captured from a live call to fetch-code:

{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000166\",\"result\":{\"content\":\"\",\"note\":\"no CodeChunk matched; re-sync the repo after CodeChunk ingest shipped\",\"truncated\":false}}"
    }
  ],
  "isError": false
}
More details

Full description from the tool, as the gateway advertises it:

Fetch a single code span from the ingested codebase (CodeChunk store). Pass path + start_line/end_line from a search-code hit, or row_pk of a chunk. Response is size-capped. Do not use query-context to dump source text.

The captured call matched no chunk, so content is empty and note says to re-sync the repository. There is no 404 for a missing file.

Not marked consequential: it is audited lightly and the project's write gate never holds it.

Every tool call works the same way: How every tool call works.