Back to Blog

Technical Document Coding with AI and MCP

By Sergio Vieira Greve
Technical Document Coding with AI and MCP

How Claude Code and the Sutram MCP Server turned a 30-page standard into a working system in minutes


The challenge

Petrobras standard N-1710 Rev. N (Technical Engineering Document Coding) defines a rigorous system for identifying technical documents. Each document receives a code composed of up to 7 groups separated by hyphens:

[A-]BB-CDDD.EE-FGGGG-HHH-III-JJJ

Where each group represents, respectively: language, document category, facility, activity area, service class, origin, and a sequential number. The standard's annexes detail hundreds of valid codes for each field — Annex C (Activity Area) alone has over 900 codes, and Annex D (Service Class) around 690.

Implementing this system manually — defining fields, registering hundreds of values, configuring automatic code generation rules — is work that would normally take hours, if not days.

The initial prompt

It all started with a simple instruction to Claude Code:

"Read standard N-1710 and its annexes (A, C, and D) in PDF. Then, configure a Record Category in Sutram that implements the coding defined by the standard."

From this single request, the agent needed to:

  1. Read and interpret the main standard and 3 annexes in PDF (48 pages total)
  2. Extract all codes and descriptions from the annexes
  3. Model the metadata structure in Sutram
  4. Register more than 1,600 enumerated values
  5. Configure automatic slug generation in the standard's format
  6. Test and validate the result

The Sutram MCP Server tools

Sutram provides an MCP Server (Model Context Protocol) that allows AI agents to interact directly with the platform. This was the differentiator that made implementation possible in a single session.

The tools used, in workflow order:

1. sutram_project_info — Reconnaissance

First call: check the project state. Return: zero metadata definitions, zero record categories. Clean slate.

2. sutram_upsert_metadata — Field modeling

With the standard already interpreted, the agent created 7 metadata definitions in parallel calls:

Field Type Values
idioma (language) enum 6 (English, German, French, etc.)
categoria_documento (document category) enum 21 (Drawing, Report, Data Sheet, etc.)
instalacao (facility) text free-form (format CDDD.EE)
area_atividade (activity area) enum 903 codes from Annex C
classe_servico (service class) enum 690 codes from Annex D
origem (origin) text free-form (NORTEC code)
sequencial (sequential) computed auto-generated, 3 digits

Parallelization was essential — independent fields were created simultaneously, saving time.

3. sutram_add_enum_values — Massive data loading

Here is the most impressive part. Annexes C and D of the standard contain, together, nearly 1,600 codes. The agent:

  • Read the PDFs page by page (Annex C alone has 27 pages)
  • Extracted each code and its description
  • Loaded the values in parallel batches using sutram_add_enum_values

Example of a batch from Annex C:

{
  "key": "area_atividade",
  "values": [
    {"code": "2111", "label": "Atmospheric Distillation Unit"},
    {"code": "2112", "label": "Vacuum Distillation Unit"},
    {"code": "2113", "label": "Pre-Flash Unit"},
    ...
  ]
}

Multiple rounds of parallel calls were needed to load all values — about 15 calls total for both annexes. The sutram_add_enum_values tool performs smart merging: duplicate codes are ignored, and everything is automatically reordered.

4. sutram_upsert_record_category — Coding configuration

With the metadata ready, a single call created the Record Category with all the code generation logic:

  • computed_from: defines which fields compose the "uniqueness base" for the sequential (category + facility + area + class + origin)
  • slug_from: defines how the final code is assembled, field by field, choosing between using the code or label of each enum
  • slug_separator: the hyphen that separates the groups
{
  "slug_from": [
    {"key": "idioma", "use": "code"},
    {"key": "categoria_documento", "use": "code"},
    {"key": "instalacao", "use": "label"},
    {"key": "area_atividade", "use": "code"},
    {"key": "classe_servico", "use": "code"},
    {"key": "origem", "use": "label"},
    {"key": "sequencial", "use": "label"}
  ],
  "slug_separator": "-"
}

5. sutram_create_record — Validation

The final test: create records and verify whether the generated code matches the standard's format.

Test 1 — Descriptive Memorial in Portuguese:

Input:    category=Descriptive Memorial, facility=4300.06,
          area=Laboratory, class=Drilling, origin=PTD
Result:   MD-4300.06-8222-114-PTD-001 ✓

Test 2 — Same combination, second document:

Result:   MD-4300.06-8222-114-PTD-002 ✓  (sequential incremented)

Test 3 — Document in English:

Input:    language=English, category=Drawing, facility=5285.00,
          area=Laboratory, class=Towers, origin=PPC
Result:   I-DE-5285.00-8222-550-PPC-001 ✓  ("I-" prefix for English)

The role of MCP (Model Context Protocol)

MCP is what makes this integration possible. It allows Claude Code to interact with Sutram as if it were an advanced platform user — but with the ability to:

  • Parallelize independent calls (create multiple metadata fields at the same time)
  • Batch process large volumes of data (hundreds of codes per call)
  • Chain dependent operations (create metadata → create category → test)
  • Validate results in real time and correct errors within the same flow

Without MCP, this same task would require navigating Sutram's interface, registering each field manually, typing or importing hundreds of codes one by one, and configuring slug rules through the UI. With MCP, the agent did everything programmatically, straight from the terminal.

Session numbers

Metric Value
PDF pages read 48
Metadata definitions created 7
Enum values registered 1,614 (903 + 690 + 21)
Record category configured 1
Test records created and validated 3
Real-time corrections 1 (slug_from adjustment from label to code)

Conclusion

The combination of an AI agent capable of interpreting technical documents (Claude Code reading the standard's PDFs) with MCP tools that enable direct action on the platform (the Sutram MCP Server) creates a workflow that simply wasn't possible before.

What previously would have demanded hours of manual work — reading the standard, interpreting the rules, registering hundreds of codes, configuring the generation logic — was solved in a single conversation session. And the result is not a prototype: it is a functional, validated system, ready for production use.

This is the promise of MCP: not just asking and answering, but taking action.