Repository navigation
Agent package, slice 4: the four tools as plain methods - #109
Merged
Merged
Conversation
Fourth slice of the agent package (docs/design/agent-mode.md). AgentToolset holds the tools without any AI framework dependency; the adapter in the next slice wraps them: - graphql_query validates the query and its variables and only sends a valid one. It returns data and errors as JSON, validationErrors with a note that nothing was sent, or requestError for transport failures. - describe_operation returns each operation's description, arguments with defaults and filter and sort summaries, the return type in outline, and a starter query. - describe_type returns full detail for types, in request order, with related types in outline; filter and sort inputs get their summary line. - search_schema matches operations, types, fields and enum values, names before descriptions, ties by kind, at most 20 results. Starter queries make required arguments variables and select the first plain fields. Paged operations get no page size, because the schema does not publish the server's maximum; every starter query is checked against the test server. The "did you mean" logic moves to a shared NameSuggestions helper, and the renderer's filter and sort summary lines become reusable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth slice of the agent package described in docs/design/agent-mode.md: the four agent tools as plain methods, with no AI framework dependency. The adapter in slice 5 wraps them as
AIFunctions.Changes
AgentToolset(internal)Index: the rendered Index, for thegraphql_querytool description.QueryAsync(graphql_query): validates the query and its variables and only sends a valid query, throughGraphClient.ExecuteAsyncso per-user tokens apply. Returns JSON withdataanderrors;validationErrorswith a note that nothing was sent; orrequestErrorfor transport failures.DescribeOperations(describe_operation): description, arguments with defaults, descriptions and filter and sort summaries, the return type in outline, and a starter query. Unknown names get a "did you mean".DescribeTypes(describe_type): full detail per type in request order, plus related types in outline. Filter and sort inputs get their summary line; connection types point to their node type.Search(search_schema): operations, types, fields and enum values. Exact names first, then prefixes, substrings and descriptions; ties by kind (operation, type, field, value); at most 20 results.Starter queries: required arguments become variables and the first plain fields are selected. Paged operations get no page size: the first version added
first: 10, which the test server rejected becauseordershas a maximum page size of 2. The schema does not publish that maximum, so the server's default is used instead.Refactors: the "did you mean" logic moves from the validator to a shared
NameSuggestionshelper; renderer helpers are internal and the filter and sort summary lines reusable.Design doc: slice status and the starter-query rule.
Testing
AgentToolsetTests):graphql_queryagainst the test server: data, variables, validation errors with a check that nothing was sent, server errors.describe_operationanddescribe_typeoutput.