---
title: "Run a backend function of an owned app exactly like the HTTP route and return its status and JSON"
method: POST
path: "/api/mcp/tools/invoke_function"
tags: ["tools"]
---

# Run a backend function of an owned app exactly like the HTTP route and return its status and JSON

`POST /api/mcp/tools/invoke_function`

## Request

- Base URL: `https://finestructure.ai`
- URL: `https://finestructure.ai/api/mcp/tools/invoke_function`
- Auth: HTTP bearer

Run a backend function of an owned app exactly like the HTTP route and return its status and JSON. caller='owner' runs as the app owner; caller='anonymous' first evaluates the function policy as a public visitor and returns the 401/403 decision without running when access would be denied. Use it to verify a function (secrets, outbound calls, policy) before wiring it into the app.

## Request body

- object
  - `app_id` string, required: The app ID
  - `function` string, required: Function name, e.g. probe
  - `params` object: JSON body passed to the function
  - `caller` 'owner' | 'anonymous'
  - `headers` object: Optional extra request headers to simulate, e.g. a webhook secret header

## Response `200`

Tool executed successfully

- ToolResult
  - `ok` boolean, required
  - `tool` string, required
  - `result` object, required

## Other responses

- `400`: Invalid arguments for this tool
- `401`: Missing or invalid bearer token
- `402`: Not enough credits on the account
- `403`: Token scope does not permit this tool
- `404`: Unknown tool name
- `429`: Rate limit exceeded, retry after the indicated delay
- `500`: Internal error while executing the tool

---

[API](https://skmtc.dev/finestructure/apis/fine-structure-api.md) · [All operations](https://skmtc.dev/finestructure/apis/fine-structure-api/llms.txt) · [OpenAPI document](https://skmtc.dev/finestructure/apis/fine-structure-api/revisions/02c50ed5fd70?raw)
