Skip to content

MCP Tools Reference

Complete reference for all 28 MCP tools exposed by Valter’s Model Context Protocol server.

Valter registers 28 tools in its MCP server, available via two transport modes:

TransportClientProtocol
stdioClaude Desktop, Claude CodeJSON-RPC over stdin/stdout
HTTP/SSEChatGPT (via MCP remote), custom clientsHTTP POST with Server-Sent Events

Each tool has a name, description, JSON Schema input definition, and an async handler. Tools are rate-limited by VALTER_MCP_RATE_LIMIT_PER_MINUTE (default: 60).

Authentication depends on the transport: API key for stdio mode, HMAC for HTTP mode.

Free-text jurisprudence retrieval over STJ decisions using hybrid BM25 + semantic search. Start from this tool when you need candidate cases before calling other tools.

ParameterTypeRequiredDefaultDescription
querystringyesNatural-language legal query in Portuguese
top_kintegerno10Number of results (1-100)
strategystringno"weighted"Scoring: weighted, rrf, bm25, semantic
include_kgbooleannofalseApply knowledge graph relevance boost
rerankbooleannofalseApply cross-encoder reranking
expand_querybooleannotrueExpand query with LLM-generated legal variants (+500-1500ms)
ministrostringnoMinister name filter (normalized to uppercase, post-retrieval)
data_iniciostringnoStart date filter (YYYYMMDD, post-retrieval)
data_fimstringnoEnd date filter (YYYYMMDD, post-retrieval)
include_stj_metadatabooleannofalseInclude STJ metadata via extra PostgreSQL lookup
page_sizeintegernoPage size for cursor pagination (1-50, <= top_k)
cursorstringnoContinuation cursor from previous page

Returns: Ranked decisions with scores, total_found, latency, cache status.

Maps to: POST /v1/retrieve

Validate legal references in text against local reference data. Uses regex extraction plus in-memory reference indices.

ParameterTypeRequiredDefaultDescription
textstringyesText containing legal references to verify
check_sumulasbooleannotrueValidate sumulas against STJ/STF reference data
check_ministrosbooleannotrueValidate minister names
check_processosbooleannotrueValidate CNJ process number format only
check_legislacaobooleannotrueExtract/classify legislation mentions

Returns: Per-reference verification results and hallucination risk metrics.

Maps to: POST /v1/verify

Run heuristic IRAC analysis (regex-based) and load knowledge graph context for a legal document.

ParameterTypeRequiredDescription
document_idstringyesDocument ID (obtain via search_jurisprudence first)

Returns: IRAC labels (Issue, Rule, Application, Conclusion) plus KG entity counts.

Maps to: POST /v1/context/enrich

Find cases similar to a given decision using 70% semantic + 30% structural KG overlap.

ParameterTypeRequiredDefaultDescription
document_idstringyesSource document ID
top_kintegerno10Number of similar cases (1-100)
include_structuralbooleannotrueInclude KG structural similarity

Returns: Ranked similar cases with scores. On timeout with structural mode, retries semantic-only.

Maps to: POST /v1/similar_cases

Retrieve the full text (inteiro teor) of a specific STJ decision.

ParameterTypeRequiredDescription
document_idstringyesDocument ID (obtain via search first)

Returns: ementa, tese, razoes_decidir, and texto_completo (when available). Check has_integra in search results before calling.

Structured search over AI-extracted document features with AND-combined filters. categorias uses OR/ANY semantics; most scalar filters are exact case-sensitive; argumento_vencedor/argumento_perdedor use partial case-insensitive matching.

ParameterTypeRequiredDefaultDescription
categoriasstring[]noCategory filter (OR semantics)
dispositivo_normastringnoLegal statute filter
resultadostringnoOutcome filter (exact)
unanimidadebooleannoUnanimous decision filter
tipo_decisaostringnoDecision type (exact)
tipo_recursostringnoAppeal type (exact)
ministro_relatorstringnoReporting minister (exact)
argumento_vencedorstringnoWinning argument text (ILIKE)
argumento_perdedorstringnoLosing argument text (ILIKE)
limitintegerno20Max results (1-100)
offsetintegerno0Pagination offset

Returns: Full features plus document summary fields.

Maps to: POST /v1/search/features

Find legal criteria with split outcomes, compute divergence_score = minority / total, and rank clusters.

ParameterTypeRequiredDefaultDescription
categoria_idstringnoExact category ID filter
limitintegerno10Max clusters (1-50)

Returns: Divergence clusters ranked by score (balanced splits score highest).

Analyze split outcomes for criteria matching a legal topic, aggregated by minister.

ParameterTypeRequiredDescription
temastringyesTopic substring match on criterion names (case-insensitive)

Returns: Per-minister outcome counts for matching criteria.

Compute argument success rates (criteria, statutes, precedents) for a category and desired outcome.

ParameterTypeRequiredDefaultDescription
categoria_idstringyesLegal category ID
resultado_desejadostringno"provido"Target outcome
tipo_argumentostringno"all"Filter: criterio, dispositivo, precedente, all
min_decisionsintegerno2Minimum supporting decisions (floor: 2)
top_kintegerno10Max arguments returned (1-50, effective max ~11)

Returns: Argument chain with success rates per argument type.

Compare minister-specific success rates vs category averages.

ParameterTypeRequiredDefaultDescription
categoria_idstringyesLegal category ID
ministrostringyesMinister name (auto-uppercase)
resultado_desejadostringno"provido"Target outcome
tipo_argumentostringno"all"Argument type filter
min_decisionsintegerno1Min minister-side decisions
min_category_decisionsintegerno2Min category support (floor: 2)
top_kintegerno10Max arguments (1-50, effective max ~20)

Returns: Delta per argument, recommended_arguments (delta > 0), avoid_arguments (delta < -0.1).

Load a minister’s judicial behavior profile from the knowledge graph.

ParameterTypeRequiredDefaultDescription
ministrostringyesMinister name (auto-uppercase)
include_divergenciasbooleannotrueInclude peer divergences
include_precedentesbooleannotrueInclude most-cited decisions
limit_criteriosintegerno10Criteria cap in response (store cap: 10)

Returns: Total decisions, date range, top criteria, outcome distribution, peer divergences, most-cited decisions.

Aggregate jurisprudence counts over time for a legal criterion.

ParameterTypeRequiredDefaultDescription
criteriostringyesLegal criterion to analyze
granularitystringno"year"year or month
periodo_iniciostringnoPeriod start (YYYY or YYYY-MM)
periodo_fimstringnoPeriod end (YYYY or YYYY-MM)

Returns: Per-period buckets with provido/improvido split and heuristic trend label.

Trace outbound citation edges from a root decision through CITA_PRECEDENTE hops.

ParameterTypeRequiredDefaultDescription
decisao_idstringyesRoot decision ID
max_depthintegerno3Maximum citation hops (1-5)

Returns: Citation nodes/edges and max_depth_reached flag. Does not include inbound citations.

Rank influential decisions using simplified PageRank: in_citations * 10 + second_order * 3.

ParameterTypeRequiredDefaultDescription
limitintegerno20Top-N results (1-100)
min_citationsintegerno0Minimum direct citations filter (post-processing)

Returns: Ranked decisions with influence score and citation counts.

Return high-overlap decision pairs based on shared legal criteria. Pairwise co-occurrence, not full community detection.

ParameterTypeRequiredDefaultDescription
min_sharedintegerno3Minimum shared criteria per pair
limitintegerno20Max communities (1-100)

Returns: Decision pairs with shared criteria count and names.

Compare two decisions across five graph dimensions using weighted Jaccard scoring.

ParameterTypeRequiredDescription
source_idstringyesFirst decision ID
target_idstringyesSecond decision ID

Returns: Per-dimension stats (criteria, facts, evidence, statutes, precedents) and weighted_score in [0, 1].

Find a bidirectional shortest path between two decisions using all relationship types.

ParameterTypeRequiredDefaultDescription
source_idstringyesSource decision ID
target_idstringyesTarget decision ID
max_depthintegerno10Max path depth (1-20)

Returns: Path nodes and edges with real relationship types, or found: false.

Compute 7D structural vectors per decision (criteria/facts/evidence/statutes counts, in/out citations, encoded outcome).

ParameterTypeRequiredDefaultDescription
decisao_idsstring[]noSpecific decision IDs (max 500)
limitintegerno100Sample size when decisao_ids is omitted (1-500)

Returns: Structural embedding vectors per decision. Cached for 1 hour.

Start an asynchronous PDF analysis workflow via the Valter HTTP API bridge.

ParameterTypeRequiredDefaultDescription
filenamestringno"processo.pdf"Filename override
pdf_base64stringnoPDF in base64 (JSON mode, small files)
local_pathstringnoFile path for multipart upload (recommended)
source_systemstringno"projudi"Source system label
source_modestringno"chat_attachment"Input provenance label
rules_versionstringnoRuleset version override
min_precedent_scorenumbernoMin precedent score (0-100)
max_matches_per_phaseintegernoCap per phase (1-10)
reasonstringnoOperator note for audit
strict_infra_requiredbooleannotrueFail on missing infra

Returns: workflow_id and initial status for polling.

Poll workflow status for a previously submitted PDF analysis.

ParameterTypeRequiredDescription
workflow_idstringyesWorkflow ID from submit_case_pdf_analysis

Returns: Current state, progress, and any errors.

Fetch the consolidated result of a completed PDF analysis workflow.

ParameterTypeRequiredDescription
workflow_idstringyesWorkflow ID from submit_case_pdf_analysis

Returns: Full analysis result, or not-ready/error payload while still running.

Submit human approval/rejection for a specific workflow phase.

ParameterTypeRequiredDescription
workflow_idstringyesWorkflow ID
phase_labelstringyesPhase identifier to review
approvedbooleanyesApproval decision
reviewerstringnoReviewer identity for audit
notesstringnoReview notes

Submit final human approval/rejection for the workflow outcome.

ParameterTypeRequiredDescription
workflow_idstringyesWorkflow ID
approvedbooleanyesFinal approval decision
reviewerstringnoReviewer identity for audit
notesstringnoFinal review notes

Start a new immutable execution for an existing workflow. Does not mutate prior runs.

ParameterTypeRequiredDescription
workflow_idstringyesExisting workflow ID
rules_versionstringnoRuleset version override
min_precedent_scorenumbernoMin precedent score (0-100)
max_matches_per_phaseintegernoCap per phase (1-10)
reasonstringnoReason for audit trail
strict_infra_requiredbooleannoOverride strict infra requirement

List versioned workflow artifacts (PDF, JSON, Markdown, logs).

ParameterTypeRequiredDescription
workflow_idstringyesWorkflow ID

Returns: List of artifacts with IDs, types, and metadata.

Generate a temporary signed download URL for one workflow artifact.

ParameterTypeRequiredDescription
workflow_idstringyesWorkflow ID
artifact_idstringyesArtifact ID from get_case_workflow_artifacts

Returns: Signed URL with time-limited access.

Store or update a session-scoped key-value memory in PostgreSQL with TTL.

ParameterTypeRequiredDefaultDescription
session_idstringyesSession identifier
keystringyesMemory key (upsert by session_id + key)
valuestringyesMemory value payload
ttl_secondsintegerno86400TTL in seconds (60 to 2,592,000)

Retrieve a session-scoped memory by key.

ParameterTypeRequiredDescription
session_idstringyesSession identifier
keystringyesMemory key to retrieve

Returns: found: true with the stored value, or found: false with value: null when the key is missing or expired.

  1. Client sends a tool_use message with tool name and parameters.
  2. Valter’s MCP server processes the request via the registered handler.
  3. Server returns a tool_result with the response payload.
  1. Client calls the MCP remote endpoint with tool name and parameters.
  2. Valter bridges the request via httpx to the REST API.
  3. REST API response is formatted and returned as MCP tool result.

All tools return structured error responses with trace_id for log correlation. Common error conditions:

ErrorDescription
Backend timeoutNeo4j, Qdrant, or PostgreSQL query exceeds time limit
Service unavailableBackend service unreachable
Validation errorInvalid or missing required parameters
Not foundReferenced document or workflow does not exist
DomainToolRequired params
Searchsearch_jurisprudencequery
Searchverify_legal_claimstext
Searchget_irac_analysisdocument_id
Searchfind_similar_casesdocument_id
Searchget_document_integradocument_id
Searchsearch_features(at least one filter)
Graphget_divergencias
Graphget_turma_divergencestema
Graphget_optimal_argumentcategoria_id
Graphget_optimal_argument_by_ministrocategoria_id, ministro
Graphget_ministro_profileministro
Graphget_temporal_evolutioncriterio
Graphget_citation_chaindecisao_id
Graphget_pagerank
Graphget_communities
Graphget_structural_similaritysource_id, target_id
Graphget_shortest_pathsource_id, target_id
Graphget_graph_embeddings
Workflowsubmit_case_pdf_analysis
Workflowget_case_pdf_analysis_statusworkflow_id
Workflowget_case_pdf_analysis_resultworkflow_id
Workflowreview_case_phaseworkflow_id, phase_label, approved
Workflowreview_case_finalworkflow_id, approved
Workflowreprocess_case_analysisworkflow_id
Workflowget_case_workflow_artifactsworkflow_id
Workflowget_case_artifact_signed_urlworkflow_id, artifact_id
Memoryremembersession_id, key, value
Memoryrecallsession_id, key