Skip to content
Charming Docs
Esc
navigateopen⌘Jpreview
On this page

Query App

Run a read-only backend operation on a Charming app and return its result, without editing code.

MCP name: query_app

Tool contract

{
  "annotations": {
    "destructiveHint": false,
    "openWorldHint": true,
    "readOnlyHint": true,
    "title": "Query App"
  },
  "description": "Run a read-only backend operation on a Charming app and return its result, without editing code. Use this for operations that only read state. For operations that change state, use mutate_app. If you don't know an operation's name or which tool it needs, call get_app — each operation lists its tool.",
  "execution": {
    "taskSupport": "forbidden"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
      "app_id": {
        "description": "The app ID (UUID)",
        "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)$",
        "type": "string"
      },
      "op": {
        "description": "Operation name, routed to /api/:op inside the app module",
        "type": "string"
      },
      "params": {
        "additionalProperties": {},
        "description": "Optional JSON params",
        "propertyNames": {
          "type": "string"
        },
        "type": "object"
      }
    },
    "required": [
      "app_id",
      "op"
    ],
    "type": "object"
  },
  "name": "query_app",
  "outputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "error": {
        "additionalProperties": false,
        "description": "Set when ok=false. Always inspect kind before retrying.",
        "properties": {
          "details": {
            "additionalProperties": {},
            "description": "Handler-supplied structured context for the error. Present on kind=\"handler_error\" when the route handler attached details.",
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "errors": {
            "description": "Validation issues from the route input/output schema. Present on kind=\"invalid_input\" and kind=\"invalid_output\".",
            "items": {},
            "type": "array"
          },
          "kind": {
            "description": "Error kind from the app envelope (e.g. \"operation_failed\", \"invalid_input\", \"invalid_output\", \"handler_error\") or a transport-level fallback.",
            "type": "string"
          },
          "message": {
            "description": "Human-readable error message. Secrets are redacted.",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "message"
        ],
        "type": "object"
      },
      "ok": {
        "description": "True if the operation handler returned a successful envelope. False when the app reported an operation error — distinct from a transport/protocol error.",
        "type": "boolean"
      },
      "value": {
        "description": "Operation return value when ok=true. Shape depends on the app and op called."
      }
    },
    "required": [
      "ok"
    ],
    "type": "object"
  }
}

Was this page helpful?