Enterprise6-minute read7 languages

Let the AI Agent Propose a Code Tool, and Approve It as Admin

When an agent keeps solving the same multi-step task, it can propose a reusable code tool with code_propose_tool. The proposal runs nothing and grants nothing; an administrator reviews the program under AI Skills and creates the tool with one click, read-only and with the caller's permissions. How it works in AnythingMCP, step by step.

HCBy HelpCode teamUpdated 6 min read Open-source on GitHub

No credit card · 7-day trial · Self-host alternative available

  • 7-day free trial
    No credit card required
  • GDPR & SOC 2 ready
    EU data residency, audit logs
  • Open-source on GitHub
    Open source · AGPL-3.0
  • Works with ChatGPT, Claude, Gemini
    Any MCP-compatible client

Summary

When an agent keeps solving the same multi-step task, it can propose a reusable code tool with code_propose_tool. The proposal runs nothing and grants nothing; an administrator reviews the program under AI Skills and creates the tool with one click, read-only and with the caller's permissions. How it works in AnythingMCP, step by step.

TL;DR: An agent that answers "monthly revenue by channel" by writing the same program every week should not have to rewrite it each time, and should not be able to create tools on its own either. In AnythingMCP code mode it does the in-between: it calls code_propose_tool with a name, a description, the program and the reason it is worth keeping. That records a proposal and nothing else: no code runs, no tool appears. An administrator finds it under AI Skills → Suggested, reads the program, and clicks Create tool. The new tool is read-only and runs with each caller's own permissions; anything more is a separate, deliberate edit. Available in self-hosted AnythingMCP from v0.52.0, coming soon to AnythingMCP Cloud.

Why proposals, not self-made tools

Agents are good at spotting that a task is mechanical: the same three calls, the same join, the same sum. Turning that into a saved tool makes the next answer faster, cheaper and more consistent. But a tool is also a permanent capability in your workspace, and the program behind it was written by a model that may have read untrusted content. So the agent gets to suggest, and a person decides. It is the same principle AnythingMCP uses for skills and company memory that AI clients propose: the agent drafts, an administrator approves.

What you need

  • Self-hosted AnythingMCP v0.52.1 or later with the code runner configured (setup in step 1 here).
  • Code mode set to inline on the MCP server. inline is what offers code_execute and code_propose_tool; tools only serves saved code tools. Set it on the server's settings page (Code mode → Saved code tools + inline code), available since v0.52.1; see step 2 of the code tool tutorial.
  • The inline-code capability on the user's role. Workspace administrators have it.
  • As announced with v0.52, inline code and proposals are part of Team and Enterprise.

Step 1 — The agent solves the task inline

A user asks a question that takes several calls, for example "revenue in October, shop and B2B invoices". With inline code on, the agent writes a program and runs it with code_execute: read-only, with the user's own permissions, over the connectors the user can reach on that server. See the revenue recipe for what such a program looks like.

Step 2 — The agent proposes to keep it

When the agent finds the pattern worth keeping (on its own, or because the user says "save this as a tool"), it calls code_propose_tool with:

FieldWhat the agent fills in
nameA short tool name, e.g. monthly_revenue_by_channel
descriptionWhat the tool does and returns, for the administrator and for future callers
codeThe program, the same kind of body as for code_execute
rationaleWhy it is worth saving, e.g. "asked four times this month; replaces about 20 tool calls"
inputSchemaOptional: the tool's own parameters, e.g. month as YYYY-MM

The answer to the agent is plain: the proposal is recorded for review and will not run or become a tool until an administrator approves it. The user can be told the same.

Step 3 — The administrator reviews it

Open AI Skills in the sidebar (under Intelligence) and switch to Suggested. A proposal appears as a card marked Code tool proposal, with:

  • the scope and a note that it was proposed by an agent and is read-only, runs with the caller's permissions;
  • Why: the agent's rationale;
  • Does: the description;
  • Program with its length in characters, to read in full;
  • a note on which connector the tool will be created and that writes or author's rights can only be added later on the connector's tools page.
anythingmcp.internal/knowledge-graph
AI Skills page, tab All with one suggested item revenue_by_month marked Code tool proposal: connector Accounting, proposed by an agent, read-only, runs with the caller's permissions; Why and Does texts, the expanded Program of 419 characters, the note that creating it adds a read-only code tool on Accounting, and the buttons Create tool and Dismiss
A code tool proposal in a demo workspace: the agent's reason, what the tool does and the full program, with Create tool and Dismiss.

Read the program the way you would review a small pull request:

  1. Which tools does it call? Every amcp.run('…'). Are they the ones the description promises, and all reads?
  2. What does it return? Only what the question needs, or whole records with personal data?
  3. Does it loop sensibly? Paging that ends, batches of parallel calls, no call per row of a large table without need. A run stops after 10 seconds and 500 tool calls.
  4. Is the name and description clear enough that the AI will call it at the right moment and explain its result correctly (gross or net, which period, which systems)?

Step 4 — Create the tool, or dismiss it

Create tool runs the normal tool-creation checks: the connectors must belong to the same workspace, and the plan's number of saved code tools applies. The tool is created on the connector named in the card:

  • read-only (it may call only tools that do not change data);
  • run as invoker (every inner call is checked against the caller's own role);
  • using the proposer's connectors on that server. Open the tool afterwards and narrow Uses to the connectors and tools it really calls.

Dismiss moves the proposal to the Dismissed tab. If the agent keeps proposing something you do not want, say so in the server's instructions.

Step 5 — Only if needed: more rights, deliberately

A created tool can be edited like any code tool on the connector's MCP Tools page. Two settings are not reachable through a proposal at all:

  • Allow write tools, so the program may call tools that change data. Requires Enterprise.
  • Run as definer, so the program runs with the author's curation instead of the caller's permissions. Administrators only.

Both are re-checked when you save. That is the point of the design: an agent can never raise its own authority, because a proposal is always read-only, always invoker, and limited to connectors the proposing user could already reach.

Why this is safe

  • A proposal is inert. code_propose_tool does not execute code and does not create anything.
  • No escalation. The proposed tool can only reference the proposer's own connectors and starts read-only, as invoker.
  • A person decides. Only an administrator can turn a proposal into a tool, through the same checks as a tool written by hand.
  • Runs stay contained and audited. Once created, every run goes through the isolated code runner and is recorded with each inner tool call. See Secure code execution for AI agents.

FAQ

Can a regular user propose tools? Any user whose role has the inline-code capability, on a server with code mode inline. Without the capability, the user sees neither code_execute nor code_propose_tool.

Does the agent see whether its proposal was accepted? The agent sees the new tool in the server's tool list once it is created, like any other tool, and can call it from then on.

Can I edit the program before creating the tool? Create it, then edit it on the connector's MCP Tools page like any code tool: program, description, parameters, Uses.

Was this guide helpful?

Ship MCP to your stack in 60 seconds.

Spin up AnythingMCP on managed Cloud or self-host it on your infrastructure. Free for 7 days, no credit card.

Related guides

Enterprise

Folder Permissions per Role for AI File Search: Who Sees Which Folders in Claude and ChatGPT

Give sales, purchasing and service one AI file search over the company share, and let each role see only its folders. How AnythingMCP Enterprise folder permissions work (allow, deny, deny wins), how to plan the rules, and the alternative without Enterprise.

EN
Enterprise

Chat with Your Documents, RAG or File Search: Which Fits a Company File Server?

Uploading files into Claude Projects or ChatGPT, building RAG on a vector database, or giving the AI a full-text index of the file server as MCP tools: how the three approaches differ on exact codes and numbers, folder structure, freshness, permissions and effort, and when each one is the right choice.

Enterprise

Find an Article Number in PDF and Excel Price Lists with AI (Newest List Wins)

Ask Claude or ChatGPT for an article number and get the price row, the supplier's file name and the list's date, from hundreds of PDF and Excel price lists on your file server. How exact search, Excel rows with column names and dates keep the AI on the current list.

Enterprise

Find Technical Drawings by Part Number with AI: Search a PDF Drawing Archive

Let Claude or ChatGPT find a technical drawing by part number, drawing number or material in an archive of thousands of PDF drawings, read the title block and name the current revision. What works with PDF drawings, what is found by name only (DWG, DXF, STEP), and how to set it up with AnythingMCP File Search.

Enterprise

Search Your Company File Server with AI: PDF, Excel and Outlook Files

Make a network share, NAS or file server searchable from Claude, ChatGPT, Microsoft Copilot and Gemini: full-text search over PDFs, Excel sheets, Word and Outlook .msg files, kept in sync, with permissions per role. Self-hosted or on AnythingMCP Cloud.

Enterprise

Search an E-Mail Archive with AI: Outlook .msg and .eml Files and Their Attachments

Saved e-mails on a file server or NAS, searchable from Claude and ChatGPT: sender, date, subject, body and the text of PDF, Excel and Word attachments. Which formats AnythingMCP File Search reads (.msg, .eml), which it does not (.pst, .mbox), and how to set it up.