{"title":"Use the CLI with agents","description":"Use the Altertable CLI alongside MCP when your agent needs terminal commands, local files, ingestion, or structured query results.","order":200,"askSuggestions":["When should my agent use the CLI instead of MCP?","How do I get JSON output from the CLI?","How do I check which environment the CLI targets?"],"navigation":true,"body":{"code":"var Component=(()=>{var p=Object.create;var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),w=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of g(e))!C.call(t,o)&&o!==r&&s(t,o,{get:()=>e[o],enumerable:!(i=f(e,o))||i.enumerable});return t};var I=(t,e,r)=>(r=t!=null?p(m(t)):{},c(e||!t||!t.__esModule?s(r,\"default\",{value:t,enumerable:!0}):r,t)),L=t=>c(s({},\"__esModule\",{value:!0}),t);var d=b((P,l)=>{l.exports=_jsx_runtime});var y={};w(y,{default:()=>u,frontmatter:()=>x});var n=I(d()),x={title:\"Use the CLI with agents\",description:\"Use the Altertable CLI alongside MCP when your agent needs terminal commands, local files, ingestion, or structured query results.\",order:200,askSuggestions:[\"When should my agent use the CLI instead of MCP?\",\"How do I get JSON output from the CLI?\",\"How do I check which environment the CLI targets?\"]};function h(t){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",p:\"p\",pre:\"pre\",...t.components},{DocsCliPrerequisite:r,DocsPreviewDocument:i,DocsPreviewSection:o}=e;return r||a(\"DocsCliPrerequisite\",!0),i||a(\"DocsPreviewDocument\",!0),o||a(\"DocsPreviewSection\",!0),(0,n.jsxs)(i,{anchors:\"use-the-cli-with-agents prepare-a-profile return-structured-results\",children:[(0,n.jsxs)(o,{sectionId:\"use-the-cli-with-agents\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,n.jsx)(e.h1,{id:\"use-the-cli-with-agents\",children:\"Use the CLI with agents\"}),`\n`,(0,n.jsx)(e.p,{children:\"Use MCP for interactive Altertable operations. Add the CLI when your agent needs local files, ingestion commands, scripts, or CI. The CLI does not replace MCP, and each connection has its own authentication.\"}),`\n`,(0,n.jsx)(r,{}),`\n`]}),(0,n.jsxs)(o,{sectionId:\"prepare-a-profile\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,n.jsx)(e.h2,{id:\"prepare-a-profile\",children:\"Prepare a profile\"}),`\n`,(0,n.jsx)(e.p,{children:\"Check the profile before using the CLI alongside MCP:\"}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-altertable\",children:`altertable profile show\naltertable profile status\naltertable --agent query \"SELECT 1 AS connected\"\n`})}),`\n`,(0,n.jsx)(e.p,{children:\"Verify that the CLI profile and MCP connection target the intended organization and environment.\"}),`\n`]}),(0,n.jsxs)(o,{sectionId:\"return-structured-results\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,n.jsx)(e.h2,{id:\"return-structured-results\",children:\"Return structured results\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Use the global \",(0,n.jsx)(e.code,{children:\"--agent\"}),\" option before the subcommand:\"]}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-altertable\",children:`altertable --agent query \"SELECT table_catalog, table_schema, table_name FROM information_schema.tables LIMIT 10\"\n`})}),`\n`,(0,n.jsxs)(e.p,{children:[\"This returns structured JSON without a pager, colors, or terminal styling. Discover tables before querying them and bound exploratory results with \",(0,n.jsx)(e.code,{children:\"LIMIT\"}),\".\"]}),`\n`,(0,n.jsxs)(e.p,{children:[\"For commands and options, see the \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli\",children:\"CLI reference\"}),\".\"]})]})]})}function u(t={}){let{wrapper:e}=t.components||{};return e?(0,n.jsx)(e,{...t,children:(0,n.jsx)(h,{...t})}):h(t)}function a(t,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+t+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return L(y);})();\n;return Component;"},"_id":"docs/agents/cli.mdx","_raw":{"sourceFilePath":"docs/agents/cli.mdx","sourceFileName":"cli.mdx","sourceFileDir":"docs/agents","contentType":"mdx","flattenedPath":"docs/agents/cli"},"type":"Docs","path":"/agents/cli","level":2,"parent":"agents"}