Skip to main content
Glama

Get Selected Text

get_selected_text
Read-onlyIdempotent

Returns the text highlighted in the Xojo IDE code editor, including its character offset and length, so you can inspect selections or locate offsets for editing. Requires an active code editor.

Instructions

Returns the text selected in the Xojo IDE's code editor, after a first line 'start= length=' giving its position in characters from the start of the item's code. Fails if no code editor is active. Use it to see what the user has highlighted, or to find offsets for set_selected_text; to read a whole item, use get_code. Needs the Xojo IDE running with the project open.

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare it a safe read (readOnlyHint, idempotent, non-destructive), yet the description adds materially more: the exact first-line output format 'start=<offset> length=<n>' with offset semantics, the failure mode ('fails if no code editor is active'), and the environment precondition. That is precisely the residual context annotations cannot carry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense but purposeful, with the return shape front-loaded in the first sentence and the usage/sibling routing following. The opening sentence is long and packs return format, offset definition and failure mode together, which slightly hurts scanability but no sentence is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, yet the description fully specifies the return shape and its header line, the failure case, and the operating precondition. For a zero-parameter read tool, nothing an agent needs in order to call it correctly or interpret the result is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Zero parameters, so baseline is 4. The description nevertheless supplies the meaning the caller needs: the offset unit is characters from the start of the item's code, which is the same coordinate system set_selected_text expects — useful given the sibling relationship.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: returns the text selected in the Xojo IDE's code editor. It also names the boundaries against siblings (get_selected_text vs. get_code vs. set_selected_text), so the agent can distinguish this tool from them without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use cases ('see what the user has highlighted', 'find offsets for set_selected_text') and a clear when-not-to ('to read a whole item, use get_code'), naming the alternative tool directly. Prerequisite condition (IDE running with project open) is stated too.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.