Skip to content

Tools for the assistant (MCP)

The TV can give a language model tools: things it may do on the TV, such as open an app, switch an input or skip a song. The service serves every tool over the Model Context Protocol (MCP), so the voice assistant and any other MCP client on the TV use the same list.

Where the tools come from:

Source What it gives Needs
The service itself (helper/coretools.js) The table below Nothing: always there
Add-ons that provide tools Whatever the add-on's service returns (see Add-ons) The add-on installed and switched on
Apps and add-ons that sign a tools.json The tools they declare The Agent tools (MCP) add-on, and your approval of that app or add-on

The service's own tools

Tool What it does Arguments
list_apps The installed apps (id and name) query?: words of the name
launch_app Opens an app id
list_inputs The HDMI ports and Live TV, with their names and whether something is connected
switch_input Switches to an input input: HDMI_1, 1 or its name
show_notification A card on the screen title, text?, image? (http or https), seconds? (2-60, 10), position? (top-right, bottom-center and the other seven)
get_current_app The app or input on the screen now (Home is called Home)
list_running_apps The apps that are open, and background services
close_app Closes one running app (never Home) id
navigate Goes to Home, the launcher's Live TV, or the Inputs list, as a remapped button does; LG's screen saver is closed first (the Inputs list would open under it) to: home, live_tv, input_list
get_volume The volume, mute, the maximum and the sound output
tv_info Model, webOS (SDK) version, firmware, CleanYourTV version, power state, whether an update is available (from the last check; it does not check)
most_used_apps The apps used most, from the launcher's usage counts limit? (1-20, 5)
get_weather The weather now and the next days (Open-Meteo); without a place, the place of a card on Home (the weather card first, else a downloaded forecast card) place?, unit?: c or f
new_conversation The voice assistant forgets the conversation so far
theme The look of Home: list the themes and the one in use, set one (downloaded from GitHub first, as on the phone page), revert to the one before action: list, set, revert; id?, accent? (a colour such as #4c8dff)
remote_buttons The remote buttons remapped on this TV: list them and what each does, or press one (it runs only while remapping is on) action: list, press; code?
power_off Turns the TV off (destructive: only by voice, after a yes)

The tools that change what is on screen (launch_app, switch_input, close_app, navigate, show_notification, remote_buttons) first close LG's screen saver if it is on: it starts when nobody has pressed a key for a while, and the Inputs list and cards would open under it.

The add-ons' tools

Each add-on gives one tool with an action, so the tools stay under the 40 the service sends. They are there while the add-on is installed and switched on.

Add-on Tool Actions
Spotify now playing spotify now_playing (the track, the artist, the device), play, pause, next, previous, devices (the Spotify Connect devices, by name), open_on_tv (the Spotify app of the TV on what plays). The controls need Spotify Premium. Moving the music to another device is not a tool: it can wake a speaker in another room
Weather forecast weather forecast (place, unit?, days? 1-7: now with feels like, humidity, wind, UV, air quality, sunrise and sunset, the next six hours and the days), find_place. The service's own get_weather is the short answer, and knows the place of the card on Home
Live TV (IPTV, bundled) iptv status (set up, how many channels, a guide), find_channel (query: words of the name or a number), whats_on and schedule (channel: now and next, or the next eight programmes), favourites, set_favourite (channel, on), check_stream (does the stream answer), refresh (load the playlist and guide again). No answer holds a stream or playlist address: they can carry the playlist's user name and password
Android box (bundled) androidbox status (set up, its input, how many apps), list_apps (the TV apps that open on the box, with their Android package), test (connect over ADB and read the model), set_app (id, on: open an app on the box or on the TV). Opening such an app is launch_app
Unsplash unsplash status (set up, on, the search words, paused for the hourly limit), set_query (query: the words photos are searched by), turn (on), credits (who took the photo on Home now). No answer holds the Access Key, not even its last characters
App icons (bundled) icons list_custom: the apps that show a picture of their own. Resetting a picture is not a tool: it deletes it
Agent tools (MCP) agent list_sources: every app and add-on that signs tools, whether it is approved, its tools and errors. Approving stays on the phone page: the model never approves tools for itself

Choosing the tools

In the manager app, Features > AI agents (MCP) > Tools chooses which tools the voice assistant and network agents may use. The same choice holds for both: they share one tool list. The row on the AI agents screen says how many are on (38 of 44 on).

Row What it does
New tools What happens to a tool the TV has not seen before (an add-on installed or updated, a service update): Turn on by themselves (the default) or Stay off until you turn them on. Tools you already chose keep their state when you change this
A group The service's tools in four groups (Apps and inputs, Screen and Home, TV and sound, Answers) and one group per add-on. A dot and a count: All on · 7, 5 of 7 on (half dot), Off; Add-on is off when the add-on is switched off. OK or Right opens the group, Left closes it. One group is open at a time (opening one closes the other), and the screen opens with every group closed
All … tools The group's first row: switches the whole group. A group that is partly on is turned all on first, then all off
A tool One switch per tool, and per action of an add-on's tool, each by what it does ("Open an app", Spotify's "Play", "Next track"); the screen shows no internal names. Turning the TV off is marked voice only, after a yes
Agents can disconnect themselves Always on, and not a switch (disconnect_from_tv): an agent must always be able to leave

How it behaves:

  • Every tool gets an explicit on or off the first time the TV sees it, by the New tools setting, before any agent or the voice assistant is given the list. The very first time (after the update that brings this screen) every tool is on.
  • A new tool has a New badge (and its group "2 new") until you close its group or switch it. With Stay off, a card says which part has new tools: "Spotify has 2 new tools".
  • A tool that is off is not in tools/list, and a call to it answers that it is turned off on the TV. An add-on tool with some actions off lists only the actions that are on; with all of them off it is left out.
  • An add-on that is switched off or removed keeps its choices; they come back with it. A tool an update takes away is forgotten.
  • At most 40 tools are sent, counting only the tools that are on, so turning tools off frees room.
  • Changes are saved at once (config.json: tools {newTools, state, fresh, seen}).

The voice assistant uses them

In the manager app, Features > AI agents (MCP) > Let the voice assistant act on the TV (or the box on the voice setup page) lets the AI use the tools. The same screen holds the network access below, so everything the tools may reach is switched in one place. It is off by default; off, the AI only answers questions as before. Then:

  1. Home Assistant still answers first when the routing says so (Voice).
  2. Otherwise the AI providers are asked in their order (Voice). Every provider, OpenRouter or a server of yours (Ollama and the like), gets the question with the tools (at most 40); the model of a server must take tools (Ollama: a model marked "tools", with a context large enough for them). The model may ask for tools; the TV runs them, sends back what they answered and asks again, at most five rounds. The card on the screen says which tool runs. Once a tool has run, the question is not handed to the next provider, so nothing is done twice.
  3. The model's last words are the answer on the card.

A tool that turns something off or deletes something (power_off, or a signed tool with "confirm": true) never runs on the model's word. The TV shows Turn the TV off? Say yes within 30 seconds to go ahead. Hold the mic and say "yes" (also "yeah", "ok", "do it", "go ahead", "confirm", with or without "please"): the TV runs it without asking the model again. The whole reply must be the yes: "okay, what's the weather" or "sure, why not" is not one. Anything else, or 30 seconds of silence, drops it.

Some models cannot use tools (OpenRouter's, or a server's). The voice setup page marks the ones that can (can act). With a model that cannot, the TV asks once more without tools and the AI only answers.

The MCP endpoint

POST /api/mcp on the service answers JSON-RPC 2.0: initialize, ping, tools/list, tools/call. It lists the tools of the service and of every add-on that provides them; a name that two sources use gets the add-on's id in front (spotify__next).

# on the TV (ssh)
curl -X POST localhost:8765/api/mcp -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -X POST localhost:8765/api/mcp \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"switch_input","arguments":{"input":"HDMI_1"}}}'

tools/list answers {tools: [{name, description, inputSchema}]}; a destructive tool also has annotations: {destructiveHint: true}. tools/call answers {content: [{type: "text", text}], isError}. The arguments are checked against the tool's inputSchema first, and keys it does not declare are dropped before the tool runs. A destructive tool is refused here (isError: true): only the voice assistant runs it, after you said yes on the TV.

Like the rest of the service API, the endpoint answers on 127.0.0.1 only: programs on the TV can use it. For an agent on another computer, switch on the network access (below).

MCP on the network

In the manager app, Features > AI agents (MCP) > Accept MCP clients from the network lets MCP clients on other computers (any agent or app that supports MCP, or a script) use the same tools at http://<tv>:8802/mcp. Off by default. Everything is managed on that screen; there is no page on Home for it.

Connecting an agent. Connect an agent shows a QR code, its address and a 6-digit code. Open the address on a phone or a computer: Connect an agent to the TV has a ready prompt with Copy the prompt. Paste it to your agent. The agent pairs once:

curl -s -X POST http://<tv>:8802/pair -H "content-type: application/json" -d '{"code":"123456","name":"My agent"}'
# {"token":"<id>.<secret>","name":"My agent","mcp":"http://<tv>:8802/mcp"}

and then adds the server to its own MCP settings: a remote (Streamable HTTP) server named tv at http://<tv>:8802/mcp with the header Authorization: Bearer <token>. The prompt names no app: any MCP client works, in its own way of adding a server. Many take {"mcpServers":{"tv":{"url":"http://<tv>:8802/mcp","headers":{"Authorization":"Bearer <token>"}}}}. A client that only starts local programs uses the mcp-remote bridge:

{ "mcpServers": { "tv": { "command": "npx",
    "args": ["mcp-remote", "http://<tv>:8802/mcp", "--allow-http", "--header", "Authorization: Bearer <token>"] } } }

An agent that already has a server tv sends its token with the pair request (Authorization: Bearer <token>). If that token still works, the TV answers {"connected":true,"name":…,"message":…} instead of a new token: the agent keeps its settings and uses the session it has, and no second entry is made (the QR screen still closes). A token that no longer works pairs as new; a blocked one is refused.

The TV shows a card with the agent's name when it connects ( connected: "This AI agent can now control the TV.", or "This AI agent was already connected.") and when it logs out or disconnects itself ( disconnected: "This AI agent can no longer control the TV."). Removing a device on the TV shows no card.

The code works once and for ten minutes; Back on the TV takes it off. The page turns green when the agent has paired, and says Connected after its first call. The token is the agent's own and is shown only once.

Managing the devices. Connected devices on the same screen ("2 paired · 1 in use") opens the list of every paired agent:

Row What it does
Each paired device Its name, In use now, Last used 3 h ago, or Blocked; a warning when it is removed within three days. OK opens Manage the device: Block this device / Allow this device (at once), Remove this device (asks first; its token stops working)
Remove unused devices A device not used for 1 day, 3 days, 1 week, 2 weeks (the default) or 1 month is removed by itself, and its token stops working; one in use is never removed. Never asks first
Remove all devices Asks first: every token stops working and each device has to pair again

Up to 10 agents can be paired. An agent can also leave by itself: the network side offers it a tool of its own, disconnect_from_tv (it is in tools/list there, not on the TV's own /api/mcp), and POST http://<tv>:8802/logout with its header does the same.

What the agent learns from the server. The pasted prompt only pairs and adds the server. Everything else comes from the server on every connection, so a new session knows it too: tools/list has every tool with its description and arguments, and the initialize reply carries instructions with the rules (destructive tools are refused from the network; 401 means pair again with a new code; 403 means blocked; at most 60 requests a minute; disconnect_from_tv to leave).

Remembering the TV. The prompt's last step asks the agent to save a short note in its own persistent memory (whatever its app calls it), so a new chat knows the TV can be controlled through the server tv. The note never holds the token, which stays in the MCP settings. Pairing again keeps the note; disconnecting deletes it. An agent without a persistent memory says so and skips the step. Port 8802 is open only while the switch is on and an agent is paired or a code is shown; if another program on the TV holds it, the switch's row says so.

  • It speaks MCP over HTTP (Streamable HTTP, every reply is JSON, no event stream).
  • Tools that turn something off or delete something are never run from the network; only your spoken yes on the TV runs them.
  • A request from a web page (it carries an Origin) is refused. Ten wrong codes or tokens lock an address out for ten minutes; a code may be tried five times a minute per address, and eight wrong codes take it off. At most 60 requests a minute. It is plain HTTP, so use it on a network you trust. See Security.

Signing tools: the agent add-on

The Agent tools (MCP) add-on (manager app, Add-ons) lets an app or add-on give tools without changing the service: it signs a tools.json. The add-on knows no app by name; it reads the declarations and gives the approved ones to the service.

The scheme

{
  "tools": [
    {
      "name": "recipes__open",
      "description": "Open the recipe app at a dish.",
      "inputSchema": { "type": "object", "properties": { "dish": { "type": "string" } }, "required": ["dish"] },
      "invoke": { "kind": "app", "id": "com.example.recipes", "params": { "dish": "{dish}" } }
    }
  ]
}
  • name: a letter, then letters, digits, _ or - (64 at most). description: what it does, for the model (300 characters).
  • inputSchema: a JSON Schema object; at most 12 arguments, each with a JSON type.
  • confirm: true for a tool that turns something off or deletes something: it then runs only after a yes. A tool that is not a plain read asks for the yes whatever it declares: every addon or http tool with a method other than GET (POST, PUT, PATCH, DELETE) is treated as confirm: true. Only a GET and an app launch run without one.
  • At most 16 tools in one file.

A {name} in the invoke is replaced by that argument. In a path or url the argument is URL-encoded; elsewhere a value that is exactly {name} keeps the argument's type.

kind Fields What it does
app id, params Launches the app with launch parameters.
addon addon, path, method, body Calls that add-on's own endpoint, /api/addons/<addon><path>. A tool reaches only the add-on that declared it: addon must be the id of its own source (addon:<id>, or a file:<id> named after the add-on); a source with a tool for another add-on is refused whole, and so is an app's declaration. The loader's paths (install, remove, repos, update, catalog), the agent add-on itself and .. are refused.
http url, method, headers, body Calls an address. The scheme and host are fixed in the file (no {argument} there); the TV itself (127.0.0.1, localhost, its own address) is refused, also when a name resolves to one (the call checks every address the name stands for), and redirects are not followed. A plain http:// call connects to the address that was checked, with the name as Host; an https:// call to the TV fails on its own, since the service speaks plain HTTP only.

Where it looks

Place Source
addons-bundled/<id>/tools.json, addons/<id>/tools.json in the service folder addon:<id>
/media/developer/apps/usr/palm/applications/<id>/tools.json app:<id>
addon-data/agent/tools/<name>.json in the service folder file:<name> (a declaration dropped by a script or an installer)

Approving

Every file is a source, and a source gives no tools until you switch it on: manager app, Add-ons > Agent tools (MCP) > Set up from your phone (port 8803, a 6-digit code on the TV, ten minutes). The page lists each source with its tools and errors. The approvals are the add-on's settings in config.json.

The add-on's own endpoints, on the TV:

Request
POST /api/addons/agent/mcp JSON-RPC for the signed tools alone
GET /api/addons/agent/tools The approved tools
GET /api/addons/agent/sources Every source: {key, kind, id, approved, error, tools}
POST /api/addons/agent/approve {source, approved} Switch a source on or off
POST /api/addons/agent/reload Read the files again

Security

The tools act as the service does: as root. What keeps that in hand:

  • The assistant uses tools only while Let the voice assistant act on the TV is on, and signed tools only from sources you approved.
  • Destructive tools need your spoken yes on the TV; neither the model nor an MCP client can give it.
  • Signed tools cannot call the service's API or anything else on the TV, and an add-on tool reaches only that add-on's own paths.
  • The agent add-on asks for net.fetch and one LG call, applicationManager/launch. An add-on's own tools run with that add-on's permissions.
  • Every round is capped: five rounds, 500 tokens a reply, 40 tools, tool results cut to 2,000 characters, 30 seconds a tool.