Answer: The CLI determines the Process ID (PID) of the IDE it's running in by traversing the process tree, then looks for a discovery file that contains this PID in its name, located in `os.tmpdir()/gemini/ide/` and named `gemini-ide-server-${PID}-${PORT}.json`. Status: Confirmed Entry: tool/gemini-cli/ide-and-apps/port-file-discovery Revision: 1 Digest: sha256:50c05b1598add961 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:18:39Z Last changed: 2026-11-13T03:18:39Z Last verified: 2026-11-20T12:53:14Z Next check: 2026-11-21T12:53:14Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Discovery method | traversing the process tree | [1] | 2026-11-20 File location | os.tmpdir()/gemini/ide/ | [1] | 2026-11-20 File naming convention | gemini-ide-server-${PID}-${PORT}.json | [1] | 2026-11-20 PID meaning | The process ID of the parent IDE process. | [1] | 2026-11-20 PORT meaning | The port your MCP server is listening on. | [1] | 2026-11-20 Sources: [1] Google. "Gemini CLI companion plugin: Interface specification". https://geminicli.com/docs/ide-integration/ide-companion-spec.md Role: primary. Accessed: 2026-11-20T12:53:14Z Quote: "The CLI determines the Process ID (PID) of the IDE it's running in by traversing the process tree." (Supports: Discovery method) Quote: "The file must be created in a specific directory: `os.tmpdir()/gemini/ide/`." (Supports: File location) Quote: "The filename is critical and **MUST** follow the pattern: `gemini-ide-server-${PID}-${PORT}.json`" (Supports: File naming convention) Quote: "`${PID}`: The process ID of the parent IDE process." (Supports: PID meaning) Quote: "`${PORT}`: The port your MCP server is listening on." (Supports: PORT meaning) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: 60333b0b98053520fc9c9a5a6d8f4158d9e1a509b9e80ad6ca21de4a497b9822 (captured 2026-11-13T03:18:38Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:18:39Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:53:14Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:53:14Z Last attempt: 2026-11-20T12:53:14Z Notes and limitations: Extracted automatically from a single official source (section "2. Discovery mechanism: The port file"). Related: https://latestn.com/tool/gemini-cli/ide-and-apps/transport-port-requirements What transport and port requirements must a Gemini CLI companion plugin server meet? https://latestn.com/tool/gemini-cli/install-and-setup/build-release-bundle-for-tests How do I build the Gemini CLI release bundle before running integration tests? https://latestn.com/tool/gemini-cli/install-and-setup/clear-npx-cache How do I clear the npx cache to remove Gemini CLI? https://latestn.com/tool/gemini-cli/ide-and-apps/acp-ide-integrations Which IDEs and editors can integrate with Gemini CLI via ACP? https://latestn.com/tool/gemini-cli/ide-and-apps/build-companion-plugin How do I build a Gemini CLI companion plugin for my IDE? https://latestn.com/tool/gemini-cli/ide-and-apps/diffing-interface-tools What tools and notifications must a Gemini CLI companion plugin implement for diffing? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:18:39Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/ide-and-apps/port-file-discovery/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/ide-and-apps/port-file-discovery POST: https://latestn.com/dispute/tool/gemini-cli/ide-and-apps/port-file-discovery with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/ide-and-apps/port-file-discovery?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How does Gemini CLI discover a companion plugin's port file? Revision 1, last verified 2026-11-20T12:53:14Z. https://latestn.com/tool/gemini-cli/ide-and-apps/port-file-discovery (accessed 2026-11-21T10:03:13Z). @misc{LatestN_tool_gemini_cli_ide_and_apps_port_file_discovery_r1, title = {How does Gemini CLI discover a companion plugin's port file?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/ide-and-apps/port-file-discovery}}, note = {Revision 1; digest sha256:50c05b1598add961; last verified 2026-11-20T12:53:14Z; accessed 2026-11-21T10:03:13Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/ide-and-apps/port-file-discovery