Aerostack
extension

Legal Document Analyzer Edge Function — Legal

Legal

Upload contracts and ask questions. Scope queries to a specific document, extract named clause types in parallel (payment, termination, liability, etc.). Powered by llama-3.1-70b.

aerostack @aerostack verified
Updated Mar 6, 2025
GitHub

Edge function Legal Document Analyzer Upload contracts and ask questions. Scope queries to a specific document, extract named clause types in parallel (payment, termination, liability, etc.). Powered by llama-3.1-70b.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.

terminal — aerostack cli
$ npx aerostack add aerostack/legal-document-analyzer
smart_toy

Use with AI Assistants

MCP

Connect Claude, Cursor, or any MCP-compatible client — then call this function by slug

① Add MCP Server

Add this once — access all Aerostack functions from your AI tool.

claude_desktop_config.json
{
  "mcpServers": {
    "aerostack": {
      "url": "https://mcp.aerostack.dev",
      "type": "http"
    }
  }
}

② Call this function

Ask your AI to use the call_function tool with this slug:

call_function
call_function({
  slug: "legal-document-analyzer",
  args: {}
})

Upload contracts and analyze them with AI. Scope questions to specific documents and extract named clause types.

Endpoints

Method Path Description
POST /ingest Upload contract text or URL
POST /analyze Ask a question (optional document_id to scope)
POST /extract Extract named clause types in parallel
GET /docs List uploaded contracts
DELETE /docs/:docId Remove a contract
GET /health Status check

All responses include a legal disclaimer. This does not constitute legal advice.

Metadata

upgrade Version 1.0.0
gavel License MIT
language Language javascript
cloud Provider cloudflare-worker

Tags

rag legal contracts clauses extraction
deployed_code

Build and publish your own functions

Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.

Frequently asked questions

What does the Legal Document Analyzer function do? +

Legal Document Analyzer is a serverless edge function for legal automation written in cloudflare-worker. Deploy it to Cloudflare Workers via your Aerostack workspace.

How do I deploy the Legal Document Analyzer function? +

Install the Aerostack CLI and run: ```bash aerostack deploy function @aerostack/legal-document-analyzer ``` It will be live on Cloudflare Workers in seconds.

What runtime does Legal Document Analyzer use? +

Legal Document Analyzer runs on cloudflare-worker on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.

Can I customise the Legal Document Analyzer function? +

Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.