Skip to content

Make input schemas more concise - #70

Merged
mattt merged 8 commits into
mainfrom
mattt/trim-input-schema
May 14, 2025
Merged

Make input schemas more concise#70
mattt merged 8 commits into
mainfrom
mattt/trim-input-schema

Conversation

@mattt

@mattt mattt commented May 14, 2025

Copy link
Copy Markdown
Owner

One of my pet peeves is documentation that just repeats the name of the symbol. Gosh, how it grinds my gears 😡

And yet, we're doing plenty of that now with iMCP. Mea culpa.

But it's not merely annoying, it's wasteful. We're paying for all of those extra tokens each time we make a request, and that really adds up.

This PR aims to trim the fat, rewording to make tool and parameter descriptions more concise, and removing them if they're self-explanatory (e.g. longitude in a maps.explore tool).


tools/list formatted JSON responses

wc before.json 
     868    2079   35163 before.JSON

wc after.json 
     852    1775   32307 after.JSON

This optimization reduces the response by 8.1% (2,856 characters), or about 700-750 fewer tokens. Pretty good!

@mattt mattt changed the title Make input schema descriptions more concise (or omit if unnecessary) Make input schemas more concise May 14, 2025
@mattt
mattt requested a review from Copilot May 14, 2025 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR streamlines the input schema descriptions for several services by removing redundant and verbose explanations and renaming some input keys to make them more concise.

  • Trimmed overly wordy descriptions across weather, utilities, reminders, messages, maps, location, contacts, and calendar services.
  • Renamed several input keys (e.g. “startDate” to “start”, “searchText” to “query”) to reduce unnecessary token usage.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
App/Services/Weather.swift Removed redundant details from the "weather" tool description and input schema.
App/Services/Utilities.swift Shortened the tool description to remove superfluous language.
App/Services/Reminders.swift Renamed input keys and made descriptions more concise in reminders tools.
App/Services/Messages.swift Updated key names and trimmed descriptions for message filtering.
App/Services/Maps.swift Shortened map-related descriptions without affecting functionality.
App/Services/Location.swift Removed extra verbiage from the geocoding input description.
App/Services/Contacts.swift Streamlined contact search descriptions.
App/Services/Calendar.swift Renamed several keys and simplified descriptions for calendar events.
Comments suppressed due to low confidence (3)

App/Services/Reminders.swift:30

  • Renaming input keys (e.g., 'startDate' to 'start', 'endDate' to 'end', and 'searchText' to 'query') is a breaking change. Consider adding migration notes in the documentation to ensure consumers are aware of the changes.
"startDate": .string(

App/Services/Calendar.swift:88

  • Renaming input keys for calendar events (e.g., 'startDate' to 'start', 'endDate' to 'end', 'calendarName' to 'calendar', and 'searchText' to 'query') could impact external integrations. Ensure that migration guidelines and proper documentation are provided.
if case let .string(start) = arguments["startDate"],

App/Services/Messages.swift:94

  • Changing keys (from 'startDate' to 'start', 'endDate' to 'end', and 'searchTerm' to 'query') is an API design change that might break existing clients. Please confirm that proper release notes and client communication are in place.
if let startDateStr = arguments["startDate"]?.stringValue,

@mattt

mattt commented May 14, 2025

Copy link
Copy Markdown
Owner Author

Haven't tried Copilot PR before! This seems like a good opportunity, since it's a lot of copy-pasta verification.

Edit: Not bad 😃

@mattt
mattt merged commit 13d4c03 into main May 14, 2025
@mattt
mattt deleted the mattt/trim-input-schema branch May 14, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants