AppMage

AutomationRpc

AutomationRpc provides local development discovery endpoints for inspecting live RPC contracts at runtime. It can list registered RPC method metadata and return the live request contract for a specific RPC method, but only when application automation discovery is enabled in a local development session.

Endpoints

POST /api/rpc (Method: AutomationRpc.listRpcs)

listRpcs lists live RPC method contracts that match an optional filter and search query. The endpoint validates its request body with a Zod schema and enforces a development-only runtime check before returning any data.

  • Description: Lists live RPC method contracts for authenticated local browser automation.

  • Request Body:

    {
      "method": "AutomationRpc.listRpcs",
      "params": {
        "filter": "*",
        "query": "optional search text",
        "limit": 500
      }
    }
  • Parameters:

    Name Type Required Description
    filter String No Metadata filter passed to the RPC server when collecting method contracts. Defaults to "*".
    query String No Case-insensitive text filter applied to the method name and description.
    limit Number No Maximum number of entries returned. Must be a positive integer up to 5000. Defaults to 500.
  • Response:

    {
      "success": true,
      "data": [
        {
          "method": "SomeRpc.someMethod",
          "description": "Calls SomeRpc.someMethod.",
          "parameters": {
            "type": "object",
            "properties": {}
          }
        }
      ]
    }

    Each item in data has:

    • method: the RPC method name.
    • description: the documented description for that method, or a generated fallback of Calls <method>.
    • parameters: a JSON Schema representation of the method's Zod parameter schema when one is available; otherwise an empty object schema.
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "AutomationRpc.listRpcs",
        "params": {
          "filter": "*",
          "query": "user",
          "limit": 25
        }
      }'

POST /api/rpc (Method: AutomationRpc.describeRpc)

describeRpc returns the live parameter contract and description for one RPC method. The method name is required, and the endpoint rejects unknown RPC method names.

  • Description: Returns the live parameter contract and description for one RPC method.

  • Request Body:

    {
      "method": "AutomationRpc.describeRpc",
      "params": {
        "method": "SomeRpc.someMethod"
      }
    }
  • Parameters:

    Name Type Required Description
    method String Yes The RPC method name to inspect. Must be a non-empty string.
  • Response:

    {
      "success": true,
      "data": {
        "method": "SomeRpc.someMethod",
        "description": "Calls SomeRpc.someMethod.",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    }

    The returned object has the same shape as AutomationRpc.listRpcs items:

    • method: the requested RPC method name.
    • description: the documented description for that method, or a generated fallback of Calls <method>.
    • parameters: a JSON Schema representation of the method's Zod parameter schema when one is available; otherwise an empty object schema.
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "AutomationRpc.describeRpc",
        "params": {
          "method": "SomeRpc.someMethod"
        }
      }'

Behavior Notes

Both endpoints call an internal development guard before reading RPC metadata. If automation discovery is not enabled for the current session, the request fails with the message Application automation discovery is only enabled in local development sessions.

listRpcs performs an in-memory filter over the live metadata set, matching the query value against the method name and description, then sorts results by method name and applies the requested limit.

describeRpc looks up a single RPC method by name and fails with Unknown RPC method '<method>'. when the method is not registered.

graph TD A[Incoming RPC request] --> B{Method} B -->|AutomationRpc.listRpcs| C[Check development-only automation discovery] C --> D[Load live RPC metadata set] D --> E[Describe each method] E --> F[Optional query filter] F --> G[Sort by method name] G --> H[Apply limit] H --> I[Return list] B -->|AutomationRpc.describeRpc| J[Check development-only automation discovery] J --> K[Look up method metadata] K --> L{Method exists?} L -->|Yes| M[Describe method] L -->|No| N[Throw unknown RPC method error] M --> O[Return description and parameter schema]