Skip to content
WeaversDocs
Browse documentation

Weavers / MCP documentation

Read Python source

Read a bounded part of your strategy.py file.

Read onlyget_python_source

Required permission: weavers.python_source.read

Try asking

Read my strategy.py and explain how it works, without proposing changes.

How it works

  • This shares private source code with the connected assistant. It requires the dedicated source-read permission.
  • Omit revision for the current source, or pass a positive revision number for a saved version.
  • Each response contains at most 16,384 Unicode code points. Continue using nextOffset until it is null; keep revision fixed while paging.
  • No saved source returns { source: null }. Offset counts code points, not bytes.

Inputs

FieldRequiredType & constraints
strategyIdRequiredUUID string
revisionOptionalinteger; greater than 0
offsetOptionalinteger; minimum 0; maximum 524288; default 0
View complete input JSON schema
Input schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "strategyId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "revision": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "offset": {
      "default": 0,
      "type": "integer",
      "minimum": 0,
      "maximum": 524288
    }
  },
  "required": [
    "strategyId"
  ],
  "additionalProperties": false
}

What comes back

FieldDescription
sourceString chunk; null is the entire no-source result.
strategyId, revision, sourceSha256Source identity, integer revision and hash for the full source.
offset, totalCharactersIntegers measured in Unicode code points.
nextOffsetInteger continuation offset, or null at the end.

This table describes the decoded tool result. MCP wraps it in text content and, for object results, structuredContent.

Worked example

Fictional data. Replace identifiers, revisions and hashes with values from your own Weavers workflow.

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_python_source",
    "arguments": {
      "strategyId": "11111111-1111-4111-8111-111111111111",
      "revision": 2,
      "offset": 0
    }
  }
}
Decoded result

{
  "strategyId": "11111111-1111-4111-8111-111111111111",
  "revision": 2,
  "sourceSha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "offset": 0,
  "nextOffset": null,
  "totalCharacters": 18,
  "source": "# Example source.\n"
}

If the request fails

  • Sign in and grant weavers.python_source.read before calling this tool.
  • Use resources you can access and refresh revision information when it changes.
  • Check result.isError even when HTTP returns 200.
Find the error and next step →